]> granicus.if.org Git - python/commit
Rework the way we try to check for libm overflow, given that C99 no longer
authorTim Peters <tim.peters@gmail.com>
Wed, 5 Sep 2001 22:36:56 +0000 (22:36 +0000)
committerTim Peters <tim.peters@gmail.com>
Wed, 5 Sep 2001 22:36:56 +0000 (22:36 +0000)
commita40c793d06ee2b42a5013015352616b4ca6b288b
tree5e056aac66ded03b3a6cae9118c7e109c861bfc6
parent75ed167527e688ab6160af3b387532ea3e1c6a74
Rework the way we try to check for libm overflow, given that C99 no longer
requires that errno ever get set, and it looks like glibc is already
playing that game.  New rules:

+ Never use HUGE_VAL.  Use the new Py_HUGE_VAL instead.

+ Never believe errno.  If overflow is the only thing you're interested in,
  use the new Py_OVERFLOWED(x) macro.  If you're interested in any libm
  errors, use the new Py_SET_ERANGE_IF_OVERFLOW(x) macro, which attempts
  to set errno the way C89 said it worked.

Unfortunately, none of these are reliable, but they work on Windows and I
*expect* under glibc too.
Include/pyport.h
Lib/test/test_math.py
Misc/NEWS
Modules/cmathmodule.c
Modules/mathmodule.c
Objects/floatobject.c