Bug #79001 [Opn->Nab]: subtraction int from microtime(true) give a wrong result
| From: | cmb@php.net | Date: | Thu, 19 Dec 2019 15:14:20 +0000 |
| Subject: | Bug #79001 [Opn->Nab]: subtraction int from microtime(true) give a wrong result | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224423@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79001&edit=1
ID: 79001
Updated by: cmb@php.net
Reported by: dromidror at yahoo dot com
Summary: subtraction int from microtime(true) give a wrong
result
-Status: Open
+Status: Not a bug
Type: Bug
Package: Math related
Operating System: Ubuntu 16.04.6 LTS (GNU/Linux 4.
PHP Version: 7.4.1
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
| If get_as_float is set to TRUE, then microtime() returns a float,
| which represents the current time in seconds since the Unix epoch
| accurate to the nearest microsecond.
Previous Comments:
------------------------------------------------------------------------
[2019-12-19 14:00:32] dromidror at yahoo dot com
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 this bug report at https://bugs.php.net/bug.php?id=79001&edit=1