Message140803
Is HAVE_DECL_ISINF defined in pyconfig.h? PyLong_FromDouble() uses Py_IS_INFINITY(x):
--------------------------------------
/* Py_IS_INFINITY(X)
* Return 1 if float or double arg is an infinity, else 0.
* Caution:
* X is evaluated more than once.
* This implementation may set the underflow flag if |X| is very small;
* it really can't be implemented correctly (& easily) before C99.
* Override in pyconfig.h if you have a better spelling on your platform.
* Py_FORCE_DOUBLE is used to avoid getting false negatives from a
* non-infinite value v sitting in an 80-bit x87 register such that
* v becomes infinite when spilled from the register to 64-bit memory.
* Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf
*/
#ifndef Py_IS_INFINITY
# if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1
# define Py_IS_INFINITY(X) isinf(X)
# else
# define Py_IS_INFINITY(X) ((X) && \
(Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X)))
# endif
#endif
--------------------------------------
main() in Modules/python.c starts with:
--------------------------------------
/* 754 requires that FP exceptions run in "no stop" mode by default,
* and until C vendors implement C99's ways to control FP exceptions,
* Python requires non-stop mode. Alas, some platforms enable FP
* exceptions by default. Here we disable them.
*/
#ifdef __FreeBSD__
fp_except_t m;
m = fpgetmask();
fpsetmask(m & ~FP_X_OFL);
#endif
--------------------------------------
You may try to enable this code on OpenBSD, replace "#ifdef __FreeBSD__" by "#if 1".
Can you also please try the following code?
$ python
>>> import struct
>>> struct.pack("f", float("inf"))
b'\x00\x00\x80\x7f' |
|
Date |
User |
Action |
Args |
2011-07-21 10:05:52 | vstinner | set | recipients:
+ vstinner, mark.dickinson, rpointel, landry |
2011-07-21 10:05:52 | vstinner | set | messageid: <1311242752.91.0.518080111788.issue12589@psf.upfronthosting.co.za> |
2011-07-21 10:05:52 | vstinner | link | issue12589 messages |
2011-07-21 10:05:51 | vstinner | create | |
|