#17079 [Opn->Bgs]: setlocale changes the internal representation of floats
| From: | iliaa@php.net | Date: | Tue, 17 Dec 2002 01:45:15 +0000 |
| Subject: | #17079 [Opn->Bgs]: setlocale changes the internal representation of floats | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-27913@lists.php.net to get a copy of this message | ||
ID: 17079
Updated by: iliaa@php.net
Reported By: jonathan@tricolon.com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Red Hat Linux 7.1
PHP Version: 4.3.0 RC2
Assigned To: hholzgra
New Comment:
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
If you switch to a locale where the float separator is ',' then when it
comes to output the data back to the user the float decimal point will
be depedant on the specified locale. Internally however it'll always be
'.'.
Previous Comments:
------------------------------------------------------------------------
[2002-12-16 08:56:08] jonathan@tricolon.com
> You should not use ',' to represent floats
> ALWAYS use '.' regardless of locale.
This is exactly the problem. When the locale is changed to Dutch the
internal representation of floats is changed. The separator used is
changed to ','. This behaviour is incorrect and should be fixed. Check
my initial and second post for a detailed description.
Thanks,
Jonathan
------------------------------------------------------------------------
[2002-12-16 08:46:12] iliaa@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
You should not use ',' to represent floats ALWAYS use '.' regardless of
locale.
------------------------------------------------------------------------
[2002-12-16 05:22:24] jonathan@tricolon.com
As Alexander points out, the bug is still available.
------------------------------------------------------------------------
[2002-12-03 07:41:04] flying@dom.natm.ru
This bug seems to be still available. Àt least i can reproduce it with
4.3.0RC2 on Windows 2000 with locale set to 'ru'.
<?php
setlocale (LC_ALL, 'en');
echo ('1.123'*'5').'<br>';
echo ('1,123'*'5').'<br>';
setlocale (LC_ALL, 'ru');
echo ('1.123'*'5').'<br>';
echo ('1,123'*'5').'<br>';
?>
Results are:
5.615
5
5
5,615
------------------------------------------------------------------------
[2002-10-10 11:53:59] iliaa@php.net
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
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/17079
--
Edit this bug report at http://bugs.php.net/?id=17079&edit=1