#35327 [Bgs]: inconsistent ROUND
ID: 35327
User updated by: pb at tdcspace dot dk
Reported By: pb at tdcspace dot dk
Status: Bogus
Bug Type: *General Issues
Operating System: w98
PHP Version: 4.4.1
New Comment:
Thak You very mucha - I really appreciate..
ROUND might then be best suited in fomulas and not output
Previous Comments:
------------------------------------------------------------------------
[2005-11-22 12:02:02] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Use sprintf(".%2f", 1.000) instead...
------------------------------------------------------------------------
[2005-11-22 11:58:31] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
round() returns a float value, use nnumber_fomat or
[s]printf to format it...
------------------------------------------------------------------------
[2005-11-22 11:55:03] pb at tdcspace dot dk
Description:
------------
This is not directly a dedicated bug - but i will report the behaviour
anyway.
The ROUND produce no decimals when whole numbers...
Syntax: ROUND(float, decimals)
so...
ROUND(1.345, 2) = "1.35" (OK)
but...
ROUND(1.000, 2) = "1" (we must to add ".00" to get "1.00")
This is somewhat annoying if You want to produce a list
with the same number of decimals - You must after a ROUND test on the
output and eventually add a "." and "0" 's.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35327&edit=1
Thread (4 messages)