ID:               45983
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ivoras at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: FreeBSD
 PHP Version:      5.2.6
 New Comment:

That is an expected behavior.
The strval() isn't required to you get this result, the echo statement,
var_dump(), and etc will print the value according to the precision
setting.

Thanks.


Previous Comments:
------------------------------------------------------------------------

[2008-09-03 13:42:15] ivoras at gmail dot com

Addition to the bug report: I tracked the issue down to the "precision"
setting in php.ini. When set to "4", when strval() receives a number
with 4 digits to the left of the decimal point, the output will only be
a string og 4 digits. E.g. strval(1001.1) returns "1001". The
documentation for "precision" setting says:

"""
  precision  integer
    The number of significant digits displayed in floating point
numbers. 
"""

It doesn't mention strval() (and strval() manual page doesn't mention
"precision") and it's a bit ambiguous.

(the behaviour is the same on Linux and FreeBSD).

------------------------------------------------------------------------

[2008-09-03 13:32:03] ivoras at gmail dot com

Description:
------------
Calling strval() on certain floating point numbers (not all) on FreeBSD
sometimes inexplicably truncates or rounds the result. Checked on both
FreeBSD 6.3 and 7.0. Works fine in Linux.

Reproduce code:
---------------
<?php
$v = 4867.8;
echo strval($v);
?>


Expected result:
----------------
"4867.8"

Actual result:
--------------
"4867"


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45983&edit=1

Reply via email to