#34246 [NEW]: Dividing number by half over and over eventually returns 0
| From: | platinumsupreme at aol dot com | Date: | Thu, 25 Aug 2005 09:41:24 +0000 |
| Subject: | #34246 [NEW]: Dividing number by half over and over eventually returns 0 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-83972@lists.php.net to get a copy of this message | ||
From: platinumsupreme at aol dot com
Operating system: Windows XP
PHP version: 4.4.0
PHP Bug Type: Math related
Bug description: Dividing number by half over and over eventually returns 0
Description:
------------
There is a problem out there that states that if you take a number and
keep dividing it by half you should never reach zero. But apparently in
PHP that is not the case..
Reproduce code:
---------------
<?php
$number = 50;
echo "Starting Number: $number<br>";
while($number > 0){
$number = $number / 2;
echo "Number: $number<br>";
}
?>
Expected result:
----------------
It should just go on for a ridiculous amount of time until it memory
leaks...
Actual result:
--------------
It ends up at 0.
--
Edit bug report at http://bugs.php.net/?id=34246&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34246&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34246&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34246&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34246&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34246&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34246&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34246&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34246&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34246&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34246&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34246&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34246&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34246&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34246&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34246&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34246&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34246&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34246&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34246&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34246&r=mysqlcfg