#47304 [Opn->Fbk]: typecast of numeric string to float produces strange result
From: jani@php.net Date: Wed, 04 Feb 2009 22:21:37 +0000 Subject: #47304 [Opn->Fbk]: typecast of numeric string to float produces strange result References: 1 Groups: php.bugs Request: Send a blank email to php-bugs+get-133512@lists.php.net to get a copy of this message
ID: 47304 Updated by: jani@php.net Reported By: lennartvdd at mailordersolutions dot nl -Status: Open +Status: Feedback Bug Type: Variables related Operating System: Server 2003 for SBS SP2 - IIS PHP Version: 5.2.8 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2009-02-04 12:41:54] lennartvdd at mailordersolutions dot nl Description: ------------ Typecasting or converting some numeric strings variables to a float value does not work as expected. Reproduce code: --------------- $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); Expected result: ---------------- float(-39) float(39) float(17) float(-17) float(-39) float(39) float(17) float(-17) Actual result: -------------- float(-38.:) float(38.:) float(16.:) float(-16.:) float(-38.:) float(38.:) float(16.:) float(-16.:) ------------------------------------------------------------------------ -- 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 (#133512) | next » |
|---|