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

Marc Schwartz (via MN) mschwartz at mn.rr.com
Mon Sep 18 23:05:04 CEST 2006


On Mon, 2006-09-18 at 19:31 +0200, Iñaki Murillo Arcos wrote:
> 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

Seems reasonable to me:

> acos(0.5) == pi/3
[1] FALSE

> print(acos(0.5), 20)
[1] 1.0471975511965978534

> print(pi/3, 20)
[1] 1.0471975511965976313


See R FAQ 7.31 Why doesn't R think these numbers are equal?

HTH,

Marc Schwartz



More information about the R-help mailing list