Re: [PHP] COS function

2002-02-01 Thread LaserJetter

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" <[EMAIL PROTECTED]> wrote in message
0201311400220T.00732@bjobsen">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.







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] COS function

2002-01-31 Thread Bas Jobsen

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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] COS function

2002-01-31 Thread 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.