#6019 [Ana->Csd]: document precision of floating point values
| From: | tony2001@php.net | Date: | Mon, 03 Apr 2006 07:38:54 +0000 |
| Subject: | #6019 [Ana->Csd]: document precision of floating point values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-95233@lists.php.net to get a copy of this message | ||
ID: 6019
Updated by: tony2001@php.net
Reported By: thomas at netropolis dot dk
-Status: Analyzed
+Status: Closed
Bug Type: Feature/Change Request
Operating System: NT4.0
PHP Version: 4.0.1pl2
New Comment:
See http://php.net/float
Previous Comments:
------------------------------------------------------------------------
[2002-04-28 18:16:57] jimw@php.net
updating summary.
------------------------------------------------------------------------
[2000-08-08 10:34:55] hholzgra@php.net
the precisions are machine-/build-dependant
so we can't document them in the manual
maybe we can add a section to phpinfo()
and/or some constants as in limits.h
for MIN/MAX values for integer and float
values
(passed on to feature request)
------------------------------------------------------------------------
[2000-08-08 09:37:36] waldschrott@php.net
I think this limitation isn´t mentioned anywhere clearly,
transforming into docu bug
In fact I don´t know where to look for it and I think the
php.ini precision settings has nothing to do with it...
------------------------------------------------------------------------
[2000-08-08 09:25:26] waldschrott@php.net
verified, replacing == with === in the third block will
produce 0, what is correct
for any reason the comparison is done corretly withing
strings, I think you won´t have to switch to bcmaths
functions for these tiny doubles, using var_dump() reveals
that they´re correctly stored in $GLOABLS
resumé: PHP performs return only 0,2,4 differences not 1,3,5
dealing with large numbers
example:
echo 9834567891230000-9834567891229999; // return2 s, should 1
echo 9834567891230000-9834567891230001; // returns 0, should -1
and so on
------------------------------------------------------------------------
[2000-08-08 09:07:23] stas@php.net
1. Use === when you are interested in string-to-string comparison.
2. PHP has precision limits, if you need more precision please use bc
extension.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/6019
--
Edit this bug report at http://bugs.php.net/?id=6019&edit=1