Bug #63821 [Asn->Nab]: incorrect pi value
| From: | cataphract@php.net | Date: | Thu, 20 Dec 2012 23:16:07 +0000 |
| Subject: | Bug #63821 [Asn->Nab]: incorrect pi value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-175510@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63821&edit=1
ID: 63821
Updated by: cataphract@php.net
Reported by: sandaq at gmail dot com
Summary: incorrect pi value
-Status: Assigned
+Status: Not a bug
Type: Bug
Package: Math related
Operating System: linux
PHP Version: 5.3.20
Assigned To: bjori
Block user comment: N
Private report: N
New Comment:
Nothing to see here, read about floating point numbers and their rounding error.
In[9]:= Pi \
//SetPrecision[#,MachinePrecision]& \
//SetPrecision[#,Infinity]& \
//N[#,100]&
Out[9]= 3.1415926535897931159979634685441851615905761718750000000000000000000\
> 00000000000000000000000000000000
Previous Comments:
------------------------------------------------------------------------
[2012-12-20 22:32:40] sandaq at gmail dot com
you still think its a distro problem?
------------------------------------------------------------------------
[2012-12-20 22:30:59] sandaq at gmail dot com
also tested on 3 different linux centos and 1 debian all with defined correct value of pi in math.h,
all gave the same wrong output.
------------------------------------------------------------------------
[2012-12-20 22:17:08] sandaq at gmail dot com
My distro is centos and pi is defined in math.h as correct value:
3.1415926535897932384626433832795029L
This happens on winxp also
------------------------------------------------------------------------
[2012-12-20 22:08:31] bjori@php.net
You'll need to complain to whatever distribution you are using.
We don't define the value unless math.h doesn't define it for some wacky reason
on your platform, in which case we fallback on 3.14159265358979323846.
------------------------------------------------------------------------
[2012-12-20 21:43:05] sandaq at gmail dot com
Description:
------------
php doesn't calculate the correct value of pi
Test script:
---------------
php-cli -r 'ini_set('precision','100'); echo pi();'
or
<?
ini_set('precision','100');
echo pi()."\n"; exit;
?>
Expected result:
----------------
3.141592653589793238462643383279502884197169399375
Actual result:
--------------
3.141592653589793115997963468544185161590576171875
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63821&edit=1