[R] Newbie question on precision

2010-01-08 Thread Paul Evans
Hi all, How can I get R to change the default precision value? For example: x=0.9 1-x [1] 0 Is there a way that I can get a non-zero value using some parameter, or some package? many thanks. [[alternative HTML version deleted]]

Re: [R] Newbie question on precision

2010-01-08 Thread Ted Harding
On 08-Jan-10 16:56:25, Paul Evans wrote: Hi all, How can I get R to change the default precision value? For example: x=0.9 1-x [1] 0 Is there a way that I can get a non-zero value using some parameter, or some package? many thanks. The problem here is that, as far as R

Re: [R] Newbie question on precision

2010-01-08 Thread jim holtman
FAQ 7.31 The precision of a floating point number is about 16 digits and your 'x' is at that limit. If you reduce it, you will see a result: x=0.9 1-x [1] 0 print(1-x, digits=20) [1] 0 x=0.99 print(1-x, digits=20) [1] 0.00999200722162641 On Fri,

Re: [R] Newbie question on precision

2010-01-08 Thread Magnus Torfason
Paul Evans wrote: How can I get R to change the default precision value? For example: x=0.9 1-x [1] 0 Is there a way that I can get a non-zero value using some parameter, or some package? many thanks. The 'gmp' package allows calculation with arbitrary precision rationals

Re: [R] Newbie question on precision

2010-01-08 Thread Magnus Torfason
On 1/8/2010 1:29 PM, Magnus Torfason wrote: Paul Evans wrote: How can I get R to change the default precision value? For example: x=0.9 1-x [1] 0 Is there a way that I can get a non-zero value using some parameter, or some package? many thanks. The 'gmp' package allows