Re: BUG IN PHP - FIX IT!!!
| From: | Rasmus Lerdorf | Date: | Sun, 23 Dec 2001 01:07:15 +0000 |
| Subject: | Re: BUG IN PHP - FIX IT!!! | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-7934@lists.php.net to get a copy of this message | ||
No, it is a bug in your code. You need to understand how computers
represent floating point numbers. You would see the same thing with any
programming language.
This is explained at http://www.php.net/manual/en/language.types.float.php
Either add a fuzz factor or use BC/GMP
-Rasmus
On Sun, 30 Dec 2001, Tony wrote:
> THERE IS A BUG IN YOUR PHP-INTERPRETER!!!
>
> CODE:
> echo (100*309.76) %100,"<BR>";
> echo (100*309.77) %100,"<BR>";
> echo (100*309.78) %100,"<BR>";
> echo (100*309.79) %100,"<BR>";
> echo (100*309.80) %100,"<BR>";
>
> RESULT:
>
> 76
> 77
> 77
> 79
> 80
>