#46233 [NEW]: Difference between to Float Type Castings
From: butterfly110Pro at yahoo dot com
Operating system: Windows 2003 Server R2
PHP version: 5.2.6
PHP Bug Type: Math related
Bug description: Difference between to Float Type Castings
Description:
------------
Salam,
I Saw Differences Between Float Type Castings. My Trying Are Become Below,
and This May Be Extensible For Other Numbers and Should Be Researches!
Thanks.
Reproduce code:
---------------
echo (float)1199999 . '<br />';
echo (float)1200000 . '<br />';
echo (float)1200001 . '<br />';
echo (float)1300000 . '<br />';
echo (float)1399999 . '<br />';
echo (float)1400000 . '<br />';
echo (float)1400001 . '<br />';
echo '-------------------------<br />';
echo (float)11999999 . '<br />';
echo (float)12000000 . '<br />';
echo (float)12000001 . '<br />';
echo (float)13000000 . '<br />';
echo (float)13999999 . '<br />';
echo (float)14000000 . '<br />';
echo (float)14000001 . '<br />';
echo '-------------------------<br />';
echo (float)119999999 . '<br />';
echo (float)120000000 . '<br />';
echo (float)120000001 . '<br />';
echo (float)130000000 . '<br />';
echo (float)139999999 . '<br />';
echo (float)140000000 . '<br />';
echo (float)140000001 . '<br />';
Expected result:
----------------
1199999
1200000
1200001
1300000
1399999
1400000
1400001
-------------------------
11999999
12000000
12000001
13000000
13999999
14000000
14000001
-------------------------
119999999
120000000
120000001
130000000
139999999
140000000
140000001
Actual result:
--------------
1199999
1.2E+6
1200001
1300000
1399999
1.4E+6
1400001
-------------------------
11999999
1.2E+7
12000001
13000000
13999999
1.4E+7
14000001
-------------------------
119999999
1.2E+8
120000001
130000000
139999999
1.4E+8
140000001
--
Edit bug report at http://bugs.php.net/?id=46233&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46233&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46233&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46233&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46233&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=46233&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46233&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46233&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46233&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46233&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46233&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46233&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46233&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46233&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46233&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46233&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46233&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46233&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46233&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46233&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46233&r=mysqlcfg
Thread (2 messages)
- butterfly110Pro at yahoo dot com