Edit report at http://bugs.php.net/bug.php?id=47304&edit=1
ID: 47304
User updated by: lennart dot vandendool at fonq dot nl
Reported by: lennart dot vandendool at fonq dot nl
Summary: typecast of numeric string to float produces strange
result
Status: Assigned
Type: Bug
Package: Scripting Engine problem
Operating System: win32 only
PHP Version: 5.2.9
Assigned To: pajoye
Block user comment: N
New Comment:
The same goes for php-5.3.3-nts-Win32-VC9-x86 on SBS 2003 (x86) and 2008
R2 (x64)
Previous Comments:
------------------------------------------------------------------------
[2010-11-08 18:54:24] lennart dot vandendool at fonq dot nl
I just tested php-5.3.3-Win32-VC9-x86 on Windows Server 2003 x86 and
2008 R2 x64. The problem doesn't occur anymore.
------------------------------------------------------------------------
[2010-07-13 12:45:53] ola dot andersson at liko dot se
Thank you for your suggestion pajoye.
Neither php-5.3.2-nts-Win32-VC6-x86 or php-5.3.2-nts-Win32-VC9-x86
include the extension php_mssql.dll. Without this extension I am not
able to properly upgrade and test our systems with this version of PHP.
Howcome php_mssql is no longer included with the distributions?
------------------------------------------------------------------------
[2010-07-12 13:48:17] [email protected]
Please try with 5.3.2 or 5.3.3RC2 VC9 version.
------------------------------------------------------------------------
[2010-07-12 12:53:18] ola dot andersson at liko dot se
Error occur also when fetching data from a MS SQL server having the
column value 290.00 (database Money format).
$query ="select pris from sa_jobb_3_1 WHERE id='".$id."'";
$result = mssql_query($query) or die($query);
$row = mssql_fetch_array($result,MSSQL_ASSOC);
printf("%f",$row['pris']);
The code above outputs incorrectly 28:.000000 and not as expected
290.000000
------------------------------------------------------------------------
[2010-07-12 12:43:14] ola dot andersson at liko dot se
The same error occurred for me. The installation is PHP 5.2.13 installed
on IIS7/Win server 2008.
Writing a script as suggested (see below) produces incorrect output for
the echo function. The error is however intermittent.
When refreshing the browser and rerunning the script several times
(perhaps 20-40 times) the correct numbers are sometimes displayed and
sometimes the incorrect.
Script used for testing:
for ($i=0; $i<400; $i++)
{
echo $i."-";
printf("%f\n",$i);
}
------------------------------------------------------------------------
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/bug.php?id=47304
--
Edit this bug report at http://bugs.php.net/bug.php?id=47304&edit=1