Bug #69188 [NEW]: The constant INF is set to float(0)
From: manuel at moosnet dot de
Operating system: SunOS 5.10
PHP version: Irrelevant
Package: Math related
Bug Type: Bug
Bug description:The constant INF is set to float(0)
Description:
------------
First, sorry, this is on a shared hoster (strato.de) environment and I
do not have full control over the PHP version that is used; I cannot use
anything current, only a variety of older versions.
Essentially, the bug is that INF is exactly equal to 0 on SunOS 5.10.
NAN seems to work fine. No string conversion is involved as far as I can
tell.
The CPU seems to be a generic x86 and Python treats INF and NAN
correctly, so it seems the FPU is not the culprit.
The only mention of this behavior I found elsewhere is this old
stackoverflow question:
http://stackoverflow.com/questions/11667512/php-inf-has-value-zero
Here's the output of a couple of test runs of the test script:
>>> uname -a
SunOS aklathep 5.10 Generic_142901-13 i86pc i386 i86pc
>>> php52 inftest.php
X-Powered-By: PHP/5.2.17
Content-type: text/html
float(0)
float(NAN)
>>> php53 inftest.php
X-Powered-By: PHP/5.3.29
Content-type: text/html
float(0)
float(NAN)
>>> php55 inftest.php
X-Powered-By: PHP/5.5.18
Content-type: text/html
float(0)
float(NAN)
>>> php56 inftest.php
X-Powered-By: PHP/5.6.2
Content-type: text/html; charset=iso-8859-1
float(0)
float(NAN)
Full version information:
>>> php52 --version
PHP 5.2.17 (cgi-fcgi) (built: Jul 30 2014 15:57:46)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
>>> php53 --version
PHP 5.3.29 (cgi-fcgi) (built: Aug 20 2014 15:52:05)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies
>>> php55 --version
PHP 5.5.18 (cgi-fcgi) (built: Oct 17 2014 12:36:29)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
>>> php56 --version
PHP 5.6.2 (cgi-fcgi) (built: Oct 16 2014 13:30:19)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
Test script:
---------------
<?php
$v = INF;
var_dump($v);
$v = NAN;
var_dump($v);
Expected result:
----------------
float(INF)
float(NAN)
Actual result:
--------------
float(0)
float(NAN)
--
Edit bug report at https://bugs.php.net/bug.php?id=69188&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69188&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69188&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69188&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69188&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69188&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69188&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69188&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69188&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69188&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69188&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69188&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69188&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69188&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69188&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69188&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69188&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69188&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69188&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69188&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69188&r=mysqlcfg
Thread (11 messages)
- manuel at moosnet dot de
- fisharebest at gmail dot comBug #69188 [Com]: The constant INF is set to float(0)
- wagner at strato-rz dot deBug #69188 [Com]: The constant INF is set to float(0)
- wagner at strato-rz dot deBug #69188 [Com]: The constant INF is set to float(0)
- tycholursen at gmail dot comBug #69188 [Com]: The constant INF is set to float(0)
- chris at chrisjean dot comBug #69188 [Com]: The constant INF is set to float(0)
- wagner at strato-rz dot deBug #69188 [Com]: The constant INF is set to float(0)
- tycholursen at gmail dot comBug #69188 [Com]: The constant INF is set to float(0)
- cmb@php.netBug #69188 [Opn->Fbk]: The constant INF is set to float(0)
- php-bugs at lists dot php dot netBug #69188 [Fbk->NoF]: The constant INF is set to float(0)
- manuel at moosnet dot deBug #69188 [Com]: The constant INF is set to float(0)