#47304 [NoF->Fbk]: typecast of numeric string to float produces strange result
From: pajoye@php.net Date: Fri, 20 Mar 2009 15:58:36 +0000 Subject: #47304 [NoF->Fbk]: typecast of numeric string to float produces strange result References: 1 Groups: php.bugs Request: Send a blank email to php-bugs+get-134937@lists.php.net to get a copy of this message
ID: 47304
Updated by: pajoye@php.net
Reported By: lennartvdd at mailordersolutions dot nl
-Status: No Feedback
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: Server 2003 for SBS SP2 - IIS
PHP Version: 5.2.8
-Assigned To:
+Assigned To: pajoye
New Comment:
What is the last version working correctly?
Previous Comments:
------------------------------------------------------------------------
[2009-02-13 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2009-02-05 14:24:34] lennartvdd at mailordersolutions dot nl
Yeah weird huh?! I changed back to PHP version: 5.2.0. Float conversion
works fine again now!
I'll try it on some different machines, but I won't have time to do
that until next week, so you'll hear more from me then.
------------------------------------------------------------------------
[2009-02-05 14:12:07] jani@php.net
Eh? How come it worked once but not after that? Can you reproduce this
with totally different machine? (works fine still for me on all machines
I have, and I have quite a few..)
------------------------------------------------------------------------
[2009-02-05 11:34:19] lennartvdd at mailordersolutions dot nl
For some strange reason the problem is reoccurring again with version
5.2.9-dev!
Reproduce code:
---------------
echo "PHP version: " . PHP_VERSION . "\n";
$var = (float)"-39.000";
var_dump($var);
$var = (float)"39.000";
var_dump($var);
$var = (float)"17.000";
var_dump($var);
$var = (float)"-17.000";
var_dump($var);
$var = "-39.000" + 0;
var_dump($var);
$var = "39.000" + 0;
var_dump($var);
$var = "17.000" + 0;
var_dump($var);
$var = "-17.000" + 0;
var_dump($var);
Actual result:
--------------
PHP version: 5.2.9-dev
float(-38.:)
float(38.:)
float(16.:)
float(-16.:)
float(-38.:)
float(38.:)
float(16.:)
float(-16.:)
------------------------------------------------------------------------
[2009-02-05 09:12:01] lennartvdd at mailordersolutions dot nl
I installed the latest version like you recommended (PHP version:
5.2.9-dev (win32 x86 VC6)). That fixed it.
------------------------------------------------------------------------
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/47304
--
Edit this bug report at http://bugs.php.net/?id=47304&edit=1
Thread (35 messages)
- #47304 [Opn->Fbk]: typecast of numeric string to float produces strange result
- #47304 [Fbk]: typecast of numeric string to float produces strange result
- #47304 [Fbk->Opn]: typecast of numeric string to float produces strange result
- #47304 [Opn]: typecast of numeric string to float produces strange result
- #47304 [Opn->Fbk]: typecast of numeric string to float produces strange result
- #47304 [Fbk->Opn]: typecast of numeric string to float produces strange result
- #47304 [Opn->Fbk]: typecast of numeric string to float produces strange result
- #47304 [NoF->Fbk]: typecast of numeric string to float produces strange result
- #47304 [Fbk]: typecast of numeric string to float produces strange result
- #47304 [Fbk]: typecast of numeric string to float produces strange result
- #47304 [Com]: typecast of numeric string to float produces strange result
- #47304 [Com]: typecast of numeric string to float produces strange result
- #47304 [Com]: typecast of numeric string to float produces strange result
- #47304 [NoF->Asn]: typecast of numeric string to float produces strange result
- #47304 [Com]: typecast of numeric string to float produces strange result
- #47304 [Com]: typecast of numeric string to float produces strange result
- #47304 [Com]: typecast of numeric string to float produces strange result
- #47304 [Com]: typecast of numeric string to float produces strange result
- #47304 [Com]: typecast of numeric string to float produces strange result
- Bug #47304 [Com]: typecast of numeric string to float produces strange result
- Bug #47304 [Asn->Fbk]: typecast of numeric string to float produces strange result
- Bug #47304 [Com]: typecast of numeric string to float produces strange result
- Bug #47304 [Fbk]: typecast of numeric string to float produces strange result
- Bug #47304 [Com]: typecast of numeric string to float produces strange result
- Bug #47304 [Com]: typecast of numeric string to float produces strange result
- Bug #47304 [Com]: typecast of numeric string to float produces strange result
- Bug #47304 [Com]: typecast of numeric string to float produces strange result
- Bug #47304 [Com]: typecast of numeric string to float produces strange result
- Bug #47304 [Fbk]: typecast of numeric string to float produces strange result
- Bug #47304 [Com]: typecast of numeric string to float produces strange result
- Bug #47304 [Fbk->Asn]: typecast of numeric string to float produces strange result
- Bug #47304 [Asn]: typecast of numeric string to float produces strange result
- Bug #47304 [Com]: typecast of numeric string to float produces strange result
- Bug #47304 [Asn->Wfx]: typecast of numeric string to float produces strange result
| « previous | php.bugs (#134937) | next » |
|---|