Re: COS function

From: Date: Fri, 01 Feb 2002 19:33:12 +0000
Subject: Re: COS function
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-83171@lists.php.net to get a copy of this message
Maybe this is something which should be changed in future PHP releases. Even the Windows Calcuator and my old scientific calc know that cos 90º is 0!! Out of interest, have you tried any results using trignonometrical identities ie tan() = sin() / cos() to see if the error cancels out in the end? Also, does arc cos(0) give you 90º? "Bas Jobsen" <bas@startpunt.cc> wrote in message news:0201311400220T.00732@bjobsen... > Cause there is no exact representation of PI, you get a floatingpoint > representation of nearly zero. > > Try: > echo intval(cos(0.5*pi())); > echo printf("%.1f",cos(0.5*pi())); > > Op donderdag 31 januari 2002 13:39, schreef michael Rabbitte: > > I was wondering about the cos fuction in PHP when I try to get cos of 90 > > degrees I'm not getting 0 but some weird no. (i.e 6.28...E-17) is there > > anything I can do to get zero as my answer. P.S. I have converted my > > degrees to radians! > > Mike.

« previous php.general (#83171) next »