SAMRAI::tbox::IEEE Struct Reference

#include <source/toolbox/base/IEEE.h>

List of all members.

Static Public Member Functions

static void setupFloatingPointExceptionHandlers ()
static float getSignalingFloatNaN ()
static double getSignalingNaN ()
static dcomplex getSignalingComplexNaN ()
static void setNaN (float &f)
static void setNaN (double &d)
static void setNaN (dcomplex &dc)
static void initializeArrayToSignalingNaN (Array< float > &array)
static void initializeArrayToSignalingNaN (Array< double > &array)
static void initializeArrayToSignalingNaN (Array< dcomplex > &array)
static void initializeArrayToSignalingNaN (float *array, int n=1)
static void initializeArrayToSignalingNaN (double *array, int n=1)
static void initializeArrayToSignalingNaN (dcomplex *array, int n=1)
static bool isNaN (const float &f)
static bool isNaN (const double &d)
static bool isNaN (const dcomplex &dc)


Detailed Description

Class IEEE is a utility providing rotuines for managing IEEE trap handlers and data set to signaling NaNs. Signaling NaNs force a trap if they are used in a numerical operation, so they are a useful way to track uninitialized floating point data. Signaling NaN's may only be used for double and float data (and the real ans imaginary parts of dcomplex data) and so operations are provided here for those types only.

IMPORTANT: To properly trap operations based on signaling NaN values, the routine IEEE::setupFloatingPointExceptionHandlers() must be called. This is normally done in the SAMRAIManager::startup() routine.

Note that all operations provided by this class (except for setting up exception handling) are implemented in

See also:
tbox::MathUtilities. Operations are provided by this class since it is not templated on data type and so calling the operations provided here may be easier in some cases, such as in codes built based on earlier versions of SAMRAI. See the tbox::MathUtilities header file for details about the routines.

tbox::MathUtilities


Member Function Documentation

void SAMRAI::tbox::IEEE::setupFloatingPointExceptionHandlers (  )  [static]

Set up IEEE exception handlers so that normal IEEE exceptions will cause a program abort. This is useful for tracking down errors. Note, however, that this may cause problems if your code relies on IEEE underflow or overflow traps.

float SAMRAI::tbox::IEEE::getSignalingFloatNaN (  )  [inline, static]

Get the IEEE float signaling NaN on architectures that support it. Using this value in a numerical expression will cause a program abort.

double SAMRAI::tbox::IEEE::getSignalingNaN (  )  [inline, static]

Get the IEEE double signaling NaN on architectures that support it. Using this value in a numerical expression will cause a program abort.

dcomplex SAMRAI::tbox::IEEE::getSignalingComplexNaN (  )  [inline, static]

Get the dcomplex value with real and imaginary parts set to the IEEE double signaling NaN on architectures that support it. Using this value in a numerical expression will cause a program abort.

void SAMRAI::tbox::IEEE::setNaN ( float &  f  )  [inline, static]

Set supplied float value to the signaling NaN.

void SAMRAI::tbox::IEEE::setNaN ( double &  d  )  [inline, static]

Set supplied double value to the signaling NaN.

void SAMRAI::tbox::IEEE::setNaN ( dcomplex dc  )  [inline, static]

Set real and imaginary parts of supplied dcomplex value to the double signaling NaN.

void SAMRAI::tbox::IEEE::initializeArrayToSignalingNaN ( Array< float > &  array  )  [static]

Initialize an array of floats to signaling NaNs. Before using this array in any operation, the NaN value should be reset. Otherwise, an unrecoverable exception will result (as long as floating point exception handling is supported by the compiler).

void SAMRAI::tbox::IEEE::initializeArrayToSignalingNaN ( Array< double > &  array  )  [static]

Initialize an array of doubles to signaling NaNs. Before using this array in any operation, the NaN value should be reset. Otherwise, an unrecoverable exception will result (as long as floating point exception handling is supported by the compiler).

void SAMRAI::tbox::IEEE::initializeArrayToSignalingNaN ( Array< dcomplex > &  array  )  [static]

Initialize an array of dcomplex to signaling NaNs. Before using this array in any operation, the NaN value should be reset. Otherwise, an unrecoverable exception will result (as long as floating point exception handling is supported by the compiler).

void SAMRAI::tbox::IEEE::initializeArrayToSignalingNaN ( float *  array,
int  n = 1 
) [static]

Initialize an array of floats to signaling NaNs. Before using this array in any operation, the NaN value should be reset. Otherwise, an unrecoverable exception will result (as long as floating point exception handling is supported by the compiler).

void SAMRAI::tbox::IEEE::initializeArrayToSignalingNaN ( double *  array,
int  n = 1 
) [static]

Initialize an array of doubles to signaling NaNs. Before using this array in any operation, the NaN value should be reset. Otherwise, an unrecoverable exception will result (as long as floating point exception handling is supported by the compiler).

void SAMRAI::tbox::IEEE::initializeArrayToSignalingNaN ( dcomplex array,
int  n = 1 
) [static]

Initialize an array of dcomplex to signaling NaNs. Before using this array in any operation, the NaN value should be reset. Otherwise, an unrecoverable exception will result (as long as floating point exception handling is supported by the compiler).

bool SAMRAI::tbox::IEEE::isNaN ( const float &  f  )  [inline, static]

Return true if the supplied float value is NaN; else, false.

bool SAMRAI::tbox::IEEE::isNaN ( const double &  d  )  [inline, static]

Return true if the supplied double value is NaN; else, false.

bool SAMRAI::tbox::IEEE::isNaN ( const dcomplex dc  )  [inline, static]

Return true if if either real and imaginary part of the supplied dcomplex value is NaN; else, false.


The documentation for this struct was generated from the following files:
Generated on Thu Jun 18 11:28:58 2009 for SAMRAI by  doxygen 1.5.1