Re: [R] Calculation error found

2022-04-07 Thread Bert Gunter
Most attachments are stripped, as was yours. However, even without the info, the answer is very likely FAQ 7.31. Computer arithmetic. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom Coun

Re: [R] Calculation error

2010-05-02 Thread Ben Bolker
oscar linares gmail.com> writes: > > Dear Rxperts, > > Running the following code: > === > twlo=10; twhi=20; wt=154; vd=0.5; cl=0.046; tau=6; t=3; F=1; > > wtkg <- wt/2.2 # convert lbs to kg > > vd.pt <- wtkg * vd # comp

Re: [R] Calculation error

2010-05-02 Thread Joshua Wiley
Dear Oscar, The problem has to do with rounding (because you set the global digits value to 2). Although what you see is 2.4*270=670; when R actually calculates it, it is using full precision. If you set options(digits=7) # the default you will see that AR=2.357362, not 2.4. HTH, Joshua On

[R] Calculation error

2010-05-02 Thread oscar linares
Dear Rxperts, Running the following code: === twlo=10; twhi=20; wt=154; vd=0.5; cl=0.046; tau=6; t=3; F=1; wtkg <- wt/2.2 # convert lbs to kg vd.pt <- wtkg * vd # compute weight-based vd (L) cl.pt <- wtkg * cl # com