Bug #80840 [NEW]: convert to int
| From: | reza dot cyber at gmail dot com | Date: | Sat, 06 Mar 2021 05:00:34 +0000 |
| Subject: | Bug #80840 [NEW]: convert to int | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-232591@lists.php.net to get a copy of this message | ||
From: reza dot cyber at gmail dot com
Operating system: all
PHP version: 7.3.27
Package: Math related
Bug Type: Bug
Bug description:convert to int
Description:
------------
Hi. I wrote these lines for the PHP 7.3.5
these codes must return 13495 but return 13494.
I try with the intval function and the result is the same as before.
but when I use the round function it returns the correct answer.
I tested by any PHP version in Linux, Windows, and other online PHP
testers.
thanks
RezaAb
Test script:
---------------
$no = 134.95;
$number = (int)($no*100);
echo $number;//print 13494
Expected result:
----------------
13495
Actual result:
--------------
13494
--
Edit bug report at https://bugs.php.net/bug.php?id=80840&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80840&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80840&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80840&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80840&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80840&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80840&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80840&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80840&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80840&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80840&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80840&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80840&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80840&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80840&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80840&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80840&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80840&r=mysqlcfg