Message95067
Just to confirm the above:
In 2.6, PyFloat_FromString in Objects/floatobject.c ends up using the
system strtod to parse "nan" and "-nan" (except that if the system
strtod fails to recognise "nan" for some reason then it returns the
result of 0.0 * Infinity instead, and in that case disregards the sign).
In 2.7 and 3.x, it ends up calling _Py_parse_inf_or_nan in
Python/pystrtod.c, and this returns 0.0 * Infinity for "nan" and -(0.0 *
Infinity) for "-nan". And depending on compiler flags, 0.0 * Infinity
ends up being either +nan (this usually seems to happen when
optimization is on, so that the compiler itself evaluates 0.0 *
Infinity), or -nan (which happens when there's no optimization and the
FPU ends up doing the 0.0 * Infinity multiplication at runtime.) This
should explain the results you're seeing. |
|
Date |
User |
Action |
Args |
2009-11-09 11:31:38 | mark.dickinson | set | recipients:
+ mark.dickinson, skrah |
2009-11-09 11:31:38 | mark.dickinson | set | messageid: <1257766298.73.0.112313414909.issue7281@psf.upfronthosting.co.za> |
2009-11-09 11:31:37 | mark.dickinson | link | issue7281 messages |
2009-11-09 11:31:37 | mark.dickinson | create | |
|