[R] Trig functions strange results

2009-07-14 Thread Nair, Murlidharan T
I am trying to calculate coordinate transformations and in the process of debugging my code using debug I found the following Browse[1] direction[i] [1] -1.570796 Browse[1] cos(direction[i]) [1] 6.123032e-17 Browse[1] cos(-1.570796) [1] 3.267949e-07 Browse[1] direction[i] [1] -1.570796 Browse[1]

Re: [R] Trig functions strange results

2009-07-14 Thread Ben Bolker
Nair, Murlidharan T wrote: I am trying to calculate coordinate transformations and in the process of debugging my code using debug I found the following Browse[1] direction[i] [1] -1.570796 Browse[1] cos(direction[i]) [1] 6.123032e-17 Browse[1] cos(-1.570796) [1] 3.267949e-07

Re: [R] Trig functions strange results

2009-07-14 Thread jim holtman
FAQ 7.31 This is what happens with floating point number and you are only printing out 7 digits of precision; look at the results cos(-1.570796) [1] 0.003267949 cos(-1.5707961) # just incrementing the digit that was not displayed [1] 0.002267949 cos(-1.5707962) [1] 0.001267949

Re: [R] Trig functions strange results

2009-07-14 Thread Nair, Murlidharan T
To: Nair, Murlidharan T Cc: r-help@r-project.org Subject: Re: [R] Trig functions strange results FAQ 7.31 This is what happens with floating point number and you are only printing out 7 digits of precision; look at the results cos(-1.570796) [1] 0.003267949 cos(-1.5707961) # just

Re: [R] Trig functions strange results

2009-07-14 Thread Stavros Macrakis
On Tue, Jul 14, 2009 at 1:45 PM, Nair, Murlidharan T mn...@iusb.edu wrote: I am trying to calculate coordinate transformations and in the process of debugging my code using debug I found the following Browse[1] direction[i] [1] -1.570796 Browse[1] cos(direction[i]) [1] 6.123032e-17