[R] Why does sin(pi) not return 0?
John Kane
jrkrideau at inbox.com
Thu Sep 26 13:21:05 CEST 2013
Definitely a Fortune.
John Kane
Kingston ON Canada
> -----Original Message-----
> From: rainer at krugs.de
> Sent: Thu, 26 Sep 2013 11:30:27 +0200
> To: r-help at stat.math.ethz.ch
> Subject: Re: [R] Why does sin(pi) not return 0?
>
> (Ted Harding) <Ted.Harding at wlandres.net> writes:
>
>> On 26-Sep-2013 07:55:38 Rolf Turner wrote:
>>> On 09/26/13 19:31, Babak Bastan wrote:
>>>> Hi experts,
>>>>
>>>> If I test sin(pi) in r, it returns me 1.224606e-16
>>>>
>>>> Why doesn't return me 0?
>>>
>
> I think this should be a Fortune:
> ,----
> | >> If you think that 1.224606e-16 is different from 0, you should
> probably not
> | >> be using computers.
> | >
> | > Is that a Fortune? And, if so, should R be using computers?
> | >
> | > sin(pi)
> | > # [1] 1.224606e-16
> | > sin(pi)==0
> | > # [1] FALSE
> `----
>
> Cheers,
>
> Rainer
>
>>
>>> See FAQ 7.31 (which is in a way about the inverse of
>>> your question, but it should provide the necessary insight).
>>>
>>> cheers,
>>> Rolf Turner
>>
>> Though, mind you, FAQ 3.71 does also offer some consolation to R:
>>
>> all.equal(0,sin(pi))
>> # [1] TRUE
>>
>> So it depends on what you mean by "different from". Computers
>> have their own fuzzy concept of this ... Babak has too fussy
>> a concept.
>>
>> Ted.
>>
>> -------------------------------------------------
>> E-Mail: (Ted Harding) <Ted.Harding at wlandres.net>
>> Date: 26-Sep-2013 Time: 09:13:33
>> This message was sent by XFMail
>>
> <#secure method=pgpmime mode=sign>
>
> --
> Rainer M. Krug
>
> email: RMKrug<at>gmail<dot>com
>
> ______________________________________________
> R-help at r-project.org 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.
____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!
More information about the R-help
mailing list