A. pygsl.ieee
Floating Point Unit Support

This chapter lists features to configure the ``Floating Point Unit'' of your machine. The exact behaviour of your Floating Point Unit can't be discussed here in general -- its just machine type dependent.

set_mode( int precision, int rounding, int exception_mask)
the mode has effect on the behaviour during calcualtion, e.g. division by zero or rounding.

The following constants are used as precision argument:

mode value definition via gsl
single_precision GSL_IEEE_SINGLE_PRECISION
double_precision GSL_IEEE_DOUBLE_PRECISION
extended_precision GSL_IEEE_EXTENDED_PRECISION
Possible round arguments are:
mode value definition via gsl
round_to_nearest GSL_IEEE_ROUND_TO_NEAREST
round_down GSL_IEEE_ROUND_DOWN
round_up GSL_IEEE_ROUND_UP
round_to_zero GSL_IEEE_ROUND_TO_ZERO
These exception arguments can be added. mask_all is the sum of all 5 mask_* constants.
mode value definition via gsl
mask_invalid GSL_IEEE_MASK_INVALID
mask_denormalized GSL_IEEE_MASK_DENORMALIZED
mask_division_by_zero GSL_IEEE_MASK_DIVISION_BY_ZERO
mask_overflow GSL_IEEE_MASK_OVERFLOW
mask_underflow GSL_IEEE_MASK_UNDERFLOW
mask_all GSL_IEEE_MASK_ALL
trap_inexact GSL_IEEE_TRAP_INEXACT

env_setup( )
sets the ieee mode from GSL_IEEE_MODE. This is not called any more automatically when importing the pygsl.

bin_repr( float value)
returns the binary representation as tuple with the following contents: (int sign, string mantissa, int exponent, int type) These values are used as type in bin_repr:
type value definition via gsl
type_nan GSL_IEEE_TYPE_NAN
type_inf GSL_IEEE_TYPE_INF
type_normal GSL_IEEE_TYPE_NORMAL
type_denormal GSL_IEEE_TYPE_DENORMAL
type_zero GSL_IEEE_TYPE_ZERO

isnan( float value)
determines if the argument is not a valid number

nan( )
generates a ``not-a-number'' value. This is implemented as function, because of the potential exception generation by your floating-point unit.

isinf( float value)
returns -1 if the argument represents a negative infinite value and +1 if positive, 0 otherwise

posinf( )
gives you the representation of ``positive infinity''

neginf( )
the same as posinf, but negative

finite( float value)
results in 1 if the value is finite, 0 if it is not a number or infinite