homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients landry, mark.dickinson, rpointel, vstinner
Date 2011年07月21日.10:05:51
SpamBayes Score 3.334764e-09
Marked as misclassified No
Message-id <1311242752.91.0.518080111788.issue12589@psf.upfronthosting.co.za>
In-reply-to
Content
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'
History
Date User Action Args
2011年07月21日 10:05:52vstinnersetrecipients: + vstinner, mark.dickinson, rpointel, landry
2011年07月21日 10:05:52vstinnersetmessageid: <1311242752.91.0.518080111788.issue12589@psf.upfronthosting.co.za>
2011年07月21日 10:05:52vstinnerlinkissue12589 messages
2011年07月21日 10:05:51vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /