Bug #79001 [NEW]: subtraction int from microtime(true) give a wrong result
| From: | dromidror at yahoo dot com | Date: | Thu, 19 Dec 2019 14:00:33 +0000 |
| Subject: | Bug #79001 [NEW]: subtraction int from microtime(true) give a wrong result | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-224414@lists.php.net to get a copy of this message | ||
From: dromidror at yahoo dot com
Operating system: Ubuntu 16.04.6 LTS (GNU/Linux 4.
PHP version: 7.4.1
Package: Math related
Bug Type: Bug
Bug description:subtraction int from microtime(true) give a wrong result
Description:
------------
$now_time - is the result of function microtime(true)*10000. The value
is a allegedly whole number with 14 digits. ( e.g. 15767617663680).
$start - is constant with value in range of $now_time value(14 digits)
$run - the result of subtracting start from now_time
Test script:
---------------
<?php
$now_time = microtime(true)*10000;
$start = 15767602956637;
$run = $now_time -$start ;
echo ($now_time - $start), " = ", $now_time, " - ", $start;
Expected result:
----------------
14707043 = 15767617663680-15767602956637
Actual result:
--------------
14707043.460938 = 15767617663680-15767602956637
Notice that PHP returns number with friction (14707043.460938) as result
of subtracting two allegedly whole numbers(15767617663680 and
15767602956637).
--
Edit bug report at https://bugs.php.net/bug.php?id=79001&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79001&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79001&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79001&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79001&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79001&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79001&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79001&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79001&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79001&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79001&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79001&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79001&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79001&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79001&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79001&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79001&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79001&r=mysqlcfg