Re: COS function
| From: | Bas Jobsen | Date: | Thu, 31 Jan 2002 13:00:22 +0000 |
| Subject: | Re: COS function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82917@lists.php.net to get a copy of this message | ||
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.