#38038 [Opn->Bgs]: range() gives back wrong values
| From: | tony2001@php.net | Date: | Sat, 08 Jul 2006 11:03:39 +0000 |
| Subject: | #38038 [Opn->Bgs]: range() gives back wrong values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-99231@lists.php.net to get a copy of this message | ||
ID: 38038
Updated by: tony2001@php.net
Reported By: mcboog at zonnet dot nl
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Windows XP Prof
PHP Version: 5CVS-2006-07-08 (snap)
New Comment:
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://docs.sun.com/source/806-3568/ncg_goldberg.html
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2006-07-08 10:49:37] mcboog at zonnet dot nl
Description:
------------
range() gives back wrong values.
Reproduce code:
---------------
<?php
$scaleMin = -0.6;
$scaleMax = 0;
$scaleStep = 0.1;
$range = range($scaleMin, $scaleMax, $scale);
print $range[6];
?>
Expected result:
----------------
0
Actual result:
--------------
-2.7755575615629E-017
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38038&edit=1