Bug #75098 [Nab]: Unexpected output
Edit report at https://bugs.php.net/bug.php?id=75098&edit=1
ID: 75098
User updated by: coolbalyan at gmail dot com
Reported by: coolbalyan at gmail dot com
Summary: Unexpected output
Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: window,ubuntu
PHP Version: 7.1.8
Block user comment: N
Private report: N
New Comment:
Thanks, not a bug
Previous Comments:
------------------------------------------------------------------------
[2017-08-22 05:14:55] spam2 at rhsoft dot net
what about reading the links you got already provided - it does NOT take 9 seconds notice the E-7
which means "move the comma 7 positions left"
------------------------------------------------------------------------
[2017-08-22 04:58:52] coolbalyan at gmail dot com
If you run the test script, it actually produces that result without taking 9 seconds. That's
odd, the script holding only
$time_start=microtime(TRUE);
/****Performance Check****/
$time_end=microtime(TRUE);
var_dump(PHP_VERSION, $time_end-$time_start);
I actually rerun it in PHP 5.6.20 and 7.1.6 it returns float(0) but in 7.1.8 and 7.0.22 it returns
higher values.
------------------------------------------------------------------------
[2017-08-20 07:49:01] requinix@php.net
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.
If you would like to know more about "floats" and what IEEE
754 is, read this:
http://www.floating-point-gui.de/
Thank you for your interest in PHP.
> it looks like it taking near around 9-10 seconds.
https://en.wikipedia.org/wiki/Scientific_notation#E-notation
------------------------------------------------------------------------
[2017-08-20 07:31:26] coolbalyan at gmail dot com
Description:
------------
When script subtract value from two "microtime", it produce value in unexpected way.
script take almost a fraction on second but substraction of value from taken from
"microtime" make it incremented. it looks like it taking near around 9-10 seconds.
Test script:
---------------
$time_start=microtime(TRUE);
/****Performance Check****/
$time_end=microtime(TRUE);
var_dump(PHP_VERSION, $time_end-$time_start);
Expected result:
----------------
0
Actual result:
--------------
9.5367431640625E-7
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75098&edit=1
Thread (5 messages)