Bug #75098 [Nab]: Unexpected output

From: Date: Tue, 22 Aug 2017 04:58:58 +0000
Subject: Bug #75098 [Nab]: Unexpected output
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210767@lists.php.net to get a copy of this message
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 +Operating System: window,ubuntu PHP Version: 7.1.8 Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#210767) next »