#35898 [NEW]: round() documentation incorrect
| From: | matt at equaliser dot net | Date: | Wed, 04 Jan 2006 20:09:17 +0000 |
| Subject: | #35898 [NEW]: round() documentation incorrect | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969371435@lists.php.net to get a copy of this message | ||
From: matt at equaliser dot net
Operating system: Linux
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: round() documentation incorrect
Description:
------------
Documentation reads
round -- Rounds a float
Description
float round ( float val [, int precision] )
Returns the rounded value of val to specified precision (number of digits
after the decimal point). precision can also be negative or zero
(default).
Should read:
Returns the rounded value of val's floating point representation in memory
to specified precision (number of digits after the decimal point).
WARNING: This function may not return expected results for floating point
numbers in memory whose string representation ends in a 5. eg:
round (7.875 , 1);
returns '7.88'
$a = 45;
$b = $a * .175;
round ($b , 1);
May return either '7.88' or '7.87'.
See http://www.php.net/manual/en/language.types.float.php
If you would like to know more about "floats" and what IEEE
754 is read this:
http://docs.sun.com/source/806-3568/ncg_goldberg.html
$
--
Edit bug report at http://bugs.php.net/?id=35898&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35898&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35898&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35898&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=35898&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35898&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35898&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35898&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35898&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35898&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35898&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=35898&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=35898&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35898&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35898&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35898&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35898&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35898&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35898&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35898&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35898&r=mysqlcfg