Bug #984: round() works bad
| From: | segi at active dot ch | Date: | Thu, 10 Dec 1998 11:06:33 +0000 |
| Subject: | Bug #984: round() works bad | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-2736@lists.php.net to get a copy of this message | ||
From: segi@active.ch
Operating system: Linux 2.0.33
PHP version: 3.0.5
PHP Bug Type: Misbehaving function
Bug description: round() works bad
echo round( 0.5 ); // is 0 but should be 1
echo round( 1.5 ); // is 2 - ok
echo round( 2.5 ); // is 2 but sould be 3
echo round( 3.5 ); // is 4 - ok
... and so on
I fixed that by simply add 0.0001 to the values
(which are variables in my case),
but that seems not a good solution to me.
Thank you for your answers.
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net