# sin(pi)?

5 messages
Open this post in threaded view
|

## sin(pi)?

 Dear all, I found something strange when calculating sin of pi value sin(pi) [1] 1.224606e-16  pi [1] 3.141593  sin(3.141593) [1] -3.464102e-07 Any help and comment should be appreciated. Regards Nguyen ____________________________ Nguyen Dinh Nguyen Garvan Institute of Medical Research Sydney, Australia ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: sin(pi)?

 > sin(3.141592653589793) [1] 1.224606e-16 Regards, Olivier Delaigue Nguyen Dinh Nguyen wrote Dear all, I found something strange when calculating sin of pi value sin(pi) [1] 1.224606e-16  pi [1] 3.141593  sin(3.141593) [1] -3.464102e-07 Any help and comment should be appreciated. Regards Nguyen
Open this post in threaded view
|

## Re: sin(pi)?

 In reply to this post by Nguyen Dinh Nguyen Nguyen Dinh Nguyen wrote: > Dear all, > I found something strange when calculating sin of pi value > sin(pi) > [1] 1.224606e-16 > >  pi > [1] 3.141593 > >  sin(3.141593) > [1] -3.464102e-07 > > Any help and comment should be appreciated. > Regards > Nguyen >   Well, sin(pi) is theoretically zero, so you are just seeing zero at two different levels of precision. The built-in pi has more digits than it displays:  > pi [1] 3.141593  > pi - 3.141593 [1] -3.464102e-07  > print(pi, digits=20) [1] 3.141592653589793 > ____________________________ > Nguyen Dinh Nguyen > Garvan Institute of Medical Research > Sydney, Australia > >   > ------------------------------------------------------------------------ > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code. >   --    O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K  (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918 ~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907 ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.