Java Mailing List Archive

http://www.r-help.com/

Home » Home (12/2007) » R Help for Statistical Computing »

Re: [R] acos(0.5) == pi/3 FALSE

Sundar Dorai-Raj

2006-09-18

Replies:


Iñaki Murillo Arcos said the following on 9/18/2006 12:31 PM:
> Hello,
>
>  I don't know if the result of
>
>  acos(0.5) == pi/3
>
> is a bug or not. It looks strange to me.
>
>   Inaki Murillo
>
> ______________________________________________
> R-help@(protected)
> 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.

This is a FAQ:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f

> acos(.5)
[1] 1.047198
> pi/3
[1] 1.047198
> acos(0.5) == pi/3
[1] FALSE
> all.equal(acos(0.5), pi/3)
[1] TRUE

--sundar

______________________________________________
R-help@(protected)
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.
©2008 r-help.com - Jax Systems, LLC, U.S.A.