#35898 [Opn->Bgs]: round() documentation incorrect

From: Date: Wed, 04 Jan 2006 21:50:43 +0000
Subject: #35898 [Opn->Bgs]: round() documentation incorrect
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969371437@lists.php.net to get a copy of this message
ID: 35898 Updated by: sniper@php.net Reported By: matt at equaliser dot net -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: Linux PHP Version: Irrelevant New Comment: There's nothing wrong with round()'s docs. See also 'precision' php.ini setting. Previous Comments: ------------------------------------------------------------------------ [2006-01-04 21:09:17] matt at equaliser dot net 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 this bug report at http://bugs.php.net/?id=35898&edit=1

« previous php.doc (#969371437) next »