Bug #75558 [NEW]: Float to integer conversion
From: cyrille dot php at giquello dot fr
Operating system: Ubuntu 16.04
PHP version: 7.1.11
Package: *General Issues
Bug Type: Bug
Bug description:Float to integer conversion
Description:
------------
Hi,
I've read the warning about float on documentation
http://php.net/manual/fr/language.types.float.php
but for simple
computing it should be nice if Php return value like other languages
(Python & Java).
The computing (int)( 103.24 * 6 * 10**2) should return 61944 nor 61943.
I've done the same with Java & Python (converting float result to
integer) and get the right result: 61944
Test script:
---------------
php -r 'echo (int)( 103.24 * 6 * 10**2),"\n";'
Expected result:
----------------
61944
Actual result:
--------------
61943
--
Edit bug report at https://bugs.php.net/bug.php?id=75558&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75558&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75558&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75558&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75558&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75558&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75558&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75558&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75558&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75558&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75558&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75558&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75558&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75558&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75558&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75558&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75558&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75558&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75558&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75558&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75558&r=mysqlcfg
Thread (9 messages)
- cyrille dot php at giquello dot fr