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

[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.

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