PHP 4.0 Bug #6851 Updated: "floor()" function rounds down an integer that resulted from a division
| From: | Bug Database | Date: | Fri, 22 Sep 2000 08:38:38 +0000 |
| Subject: | PHP 4.0 Bug #6851 Updated: "floor()" function rounds down an integer that resulted from a division | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-33553@lists.php.net to get a copy of this message | ||
ID: 6851
User Update by: virtual.spirit@digi.com.br
Status: Open
Bug Type: Math related
Description: "floor()" function rounds down an integer that resulted from a division
When using floor to round a result of a division of some specific numbers,
it rounds down a integer number.
In a division like the one below, it rounds 100 to 99. But, if you change
14056567 to another number, it will probably work fine, except when using
some numbers like 140565637.
# Script reproducing the problem:
$raw_result = (14056567/(14056567/100));
# the line below will generate error, too
# $raw_result = (140565637/(140565637/100));
$round = floor($raw_result);
echo "Raw result: $raw_result\nRounded: $round\n";
# Tested with two different PHP builds:
# --with-apxs --with-mysql --enable-ftp
# and --with-mysql --enable-ftp
Previous Comments:
---------------------------------------------------------------------------
[2000-09-22 04:22:19] virtual.spirit@digi.com.br
# Script reproducing the problem:
$raw_result = (14056567/(14056567/100));
# the line below will generate error, too
# $raw_result = (140565637/(140565637/100));
$round = floor($raw_result);
echo "Raw result: $raw_resultnRounded: $roundn";
# Tested with two different PHP builds:
# ./configure --with-apxs --with-mysql --enable-ftp
# and
# ./configure --with-mysql --enable-ftp
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=6851