bx_extras.fpconst module

Utilities for handling IEEE 754 floating point special values

This python module implements constants and functions for working with IEEE754 double-precision special values. It provides constants for Not-a-Number (NaN), Positive Infinity (PosInf), and Negative Infinity (NegInf), as well as functions to test for these values.

The code is implemented in pure python by taking advantage of the ‘struct’ standard module. Care has been taken to generate proper results on both big-endian and little-endian machines. Some efficiency could be gained by translating the core routines into C.

See <http://babbage.cs.qc.edu/courses/cs341/IEEE-754references.html> for reference material on the IEEE 754 floating point standard.

Further information on this package is available at <http://www.analytics.washington.edu/statcomp/projects/rzope/fpconst/>.

Author: Gregory R. Warnes <gregory_r_warnes@groton.pfizer.com> Date:: 2003-04-08 Copyright: (c) 2003, Pfizer, Inc.

bx_extras.fpconst.isFinite(value)

Determine if the argument is an finite IEEE 754 value (i.e., is not NaN, positive or negative inifinity)

bx_extras.fpconst.isInf(value)

Determine if the argument is an infinite IEEE 754 value (positive or negative inifinity)

bx_extras.fpconst.isNaN(value)

Determine if the argument is a IEEE 754 NaN (Not a Number) value.

bx_extras.fpconst.isNegInf(value)

Determine if the argument is a IEEE 754 negative infinity value

bx_extras.fpconst.isPosInf(value)

Determine if the argument is a IEEE 754 positive infinity value

bx_extras.fpconst.test()
bx_extras.fpconst.test_isFinite()
bx_extras.fpconst.test_isInf()
bx_extras.fpconst.test_isNaN()
bx_extras.fpconst.test_isNegInf()
bx_extras.fpconst.test_isPosInf()