php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24415 pi() and M_PI return float(3) - AGAIN
Submitted: 2003-06-30 11:54 UTC Modified: 2003-07-28 17:05 UTC
From: postings-php-bug at hans-spath dot de Assigned: edink (profile)
Status: Closed Package: Math related
PHP Version: 5.0.0b1 (beta1) OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: postings-php-bug at hans-spath dot de
New email:
PHP Version: OS:

 

 [2003-06-30 11:54 UTC] postings-php-bug at hans-spath dot de
Description:
------------
Yeah right. PI = 3 ... given a big enough 3 and a small enough pi ...

Reproduce code:
---------------
<? var_dump(array(M_PI,pi())); ?>

Expected result:
----------------
M:\php>echo "<? var_dump(array(M_PI,pi())); ?>" | 431\php -q
"array(2) {
  [0]=>
  float(3.1415926535898)
  [1]=>
  float(3.1415926535898)
}
"

Actual result:
--------------
M:\php>echo "<? var_dump(array(M_PI,pi())); ?>" | 500b1\php -q
"array(2) {
  [0]=>
  float(3)
  [1]=>
  float(3)
}
"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-30 13:38 UTC] sterling@php.net
Tested on Windows and Linux, works on both.
 [2003-06-30 14:22 UTC] php dot net at siniath dot net
Tested on Win2k SP3, fails exactly as described by reporter:

C:\PHP\5.0.0b1>echo "<? var_dump(array(M_PI,pi())); ?>" | php -q
"array(2) {
  [0]=>
  float(3)
  [1]=>
  float(3)
}
"

Definitely not bogus.
 [2003-06-30 14:27 UTC] postings-php-bug at hans-spath dot de
Ok, I've tested one of the CVS-snaps, and it worked. So I think it's "closed" now and not "bogus".

M:\php\php5-win32-200306301130>echo "<? var_dump(array(M_PI,pi())); ?>" | php -q
"array(2) {
  [0]=>
  float(3.1415926535898)
  [1]=>
  float(3.1415926535898)
}
 [2003-07-01 06:57 UTC] postings-php-bug at hans-spath dot de
===> PHP 5.0.0b1 (beta1) <===
M:\php>echo "<? var_dump(M_PI);var_dump(pi()); ?>" | 500b1\php -q
"float(3)
float(3)
"

===> PHP 5.0.0b2-dev (php5-win32-200306301130.zip) <===
M:\php>echo "<? var_dump(M_PI);var_dump(pi()); ?>" | 500dev200306301130\php -q
"float(3.1415926535898)
float(3.1415926535898)
"

===> PHP 5.0.0b2-dev (php5-win32-200307011030.zip) <===
M:\php>echo "<? var_dump(M_PI);var_dump(pi()); ?>" | 500dev200307011030\php -q
"float(3)
float(3)
"
 [2003-07-01 11:32 UTC] sniper@php.net
Works fine:

# php -r 'var_dump(pi());'
float(3.1415926535898)

Check your php.ini settings...precision especially.

 [2003-07-01 12:29 UTC] postings-php-bug at hans-spath dot de
It'm really pissed off now! What about setting the bug to "Feedback" instead of "Bogus", hu? Yes, my results are very strange, but I use *your* Builds and get different results on the same machine (Windows XP (German)). AND a friend of mine can reproduce this under Windows 2000 SP3 (German).

I use similar INIs for all 4 versions. Same Problem with CGI and CLI.

Problem exists in
(WIN) PHP 5.0.0b1 (cgi-fcgi) (built: Jun 28 2003 00:31:05)
(WIN) PHP 5.0.0b2-dev (cgi-fcgi) (built: Jul  1 2003 12:10:02)
(WIN) PHP 5.0.0b2-dev (cgi-fcgi) (built: Jul  1 2003 16:10:06)

But NOT in
(WIN) PHP 5.0.0b2-dev (cgi-fcgi) (built: Jun 30 2003 13:41:33)
(LINUX) PHP 5.0.0b2-dev (php5-200307011530.tar.bz2)

===> PHP 5.0.0b2-dev (php5-win32-200307011430.zip) <===
M:\php>echo "<? var_dump(M_PI);var_dump(pi()); ?>" | 500dev200307011430\php -q
"float(3)
float(3)
"

===> INI, precision <===
M:\php>grep -e "^precision" 500dev200307011430\php.ini
precision    =  14

===> INI, diff <===
M:\php>diff 500dev200306301130\php.ini 500dev200307011030\php.ini
377c377
< extension_dir = "m:/php/500dev200306301130/extensions/"
---
> extension_dir = "m:/php/500dev200307011030/extensions/"
778c778
< session.save_path = "m:/php/500dev200306301130/session"
---
> session.save_path = "m:/php/500dev200307011030/session"
 [2003-07-07 10:18 UTC] sniper@php.net
This is due to some funky build problem Edin has,
assigning to him. 

 [2003-07-28 17:05 UTC] edink@php.net
This problem is fixed now.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Nov 11 03:01:28 2024 UTC