[Python-Dev] RE: [Spambayes] Question (or possibly a bug report)
Thu, 24 Jul 2003 01:42:56 -0400
> How 0.1 becomes 0[.0] in German, when the damage script says it should
> equal 1x10^16, I still don't know.
The "damage" script is apparently incorrect. I added a sys.muckit()
function to my Python, like so (in sysmodule.c):
static PyObject *
sys_muckit(PyObject *self, PyObject *args)
>>> import marshal
>>> s = marshal.dumps(0.001)
>>> import sys
So when the marshaled representation of 0.001 is loaded under "german"
LC_NUMERIC here, we get back exactly 0.0. I'm not sure why. More, now that
I've screwed up the locale:
So the obvious <wink> answers are:
1. When LC_NUMERIC is "german", MS C's atof() stops at the first
period it sees.
2. Python's emulation of locale-aware atof (function atof in file
Lib/locale.py) doesn't correctly emulate the platform C atof()
in this case. I don't know why that is (and am waaaaay out of
time for today), but the "damage" script used locale.atof(), so
drew wrong conclusions about MS locale reality.