Bug #75310 [NEW]: range(0.94, 0.49, -0.01) difference
| From: | shawn at mckenzies dot net | Date: | Wed, 04 Oct 2017 19:43:54 +0000 |
| Subject: | Bug #75310 [NEW]: range(0.94, 0.49, -0.01) difference | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-211505@lists.php.net to get a copy of this message | ||
From: shawn at mckenzies dot net
Operating system: Win7,Linux
PHP version: 7.2.0RC3
Package: Arrays related
Bug Type: Bug
Bug description:range(0.94, 0.49, -0.01) difference
Description:
------------
range(0.94, 0.49, -0.01) returns a 45 element array from .94 to .5 in
PHP 7.0.3 - 7.2.0rc2 but returns the expected 46 element array .94 to
.49 in PHP 5.6.0 - 5.6.30.
Test script:
---------------
https://3v4l.org/gZ3cs#v703
$a = range(0.94, 0.49, -0.01);
echo count($a).PHP_EOL;
echo min($a).PHP_EOL;
print_r($a);
Expected result:
----------------
Same array should be created created across PHP versions.
--
Edit bug report at https://bugs.php.net/bug.php?id=75310&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75310&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75310&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75310&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75310&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75310&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75310&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75310&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75310&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75310&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75310&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75310&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75310&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75310&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75310&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75310&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75310&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75310&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75310&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75310&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75310&r=mysqlcfg