Math Functions

Defines

#define FAST_ROUND   FAST_ROUND_EXACT
#define IND   IEEE_NaN()
#define INF   IEEE_Infinity()
#define NAN   IEEE_NaN()
#define NEARINTADJ   .0000001
#define NINF   (-IEEE_Infinity())

Functions

void ConvIEEEToVAX (double ieee_value, UINT8 *vax_value)
double ConvVAXToIEEE (const UINT8 *vax_value)
INT32 FAST_CEIL (double x)
INT32 FAST_CEIL_NEARINT (double x)
INT32 FAST_FLOOR (double x)
INT32 FAST_FLOOR_NEARINT (double x)
INT32 FAST_ROUND_EXACT (double x)
INT32 FAST_ROUND_LIMITED (double x)
INT32 FAST_ROUND_NOLIMIT (double x)
INT32 FAST_ROUND_POSITIVE (double x)
INT32 FAST_TRUNCATE (double x)
INT32 FAST_TRUNCATE_NEARINT (double x)
LIBEXPORT double IEEE_Infinity (void)
LIBEXPORT double IEEE_NaN (void)
bool IsInfNeg (double x)
bool IsInfPos (double x)
bool IsNaN (const double &x)
int log2i (INT64 value, bool roundup=true)
int log2i (UINT64 value, bool roundup=true)
int log2i (INT32 value, bool roundup=true)
int log2i (UINT32 value, bool roundup=true)

Define Documentation

#define FAST_ROUND   FAST_ROUND_EXACT
#define IND   IEEE_NaN()
#define INF   IEEE_Infinity()
#define NAN   IEEE_NaN()
#define NEARINTADJ   .0000001
#define NINF   (-IEEE_Infinity())

Function Documentation

void ConvIEEEToVAX ( double  ieee_value,
UINT8 vax_value 
)

Convert IEEE floating point to VAX floating point.

Parameters:
ieee_value IEEE floating point value
vax_value Pointer to 8 byte UINT8 array for VAX floating point value
double ConvVAXToIEEE ( const UINT8 vax_value  ) 

Convert VAX floating point to IEEE floating point.

Returns:
: IEEE floating point value
Parameters:
vax_value Pointer to 8 byte UINT8 array for VAX floating point value
INT32 FAST_CEIL ( double  x  )  [inline]

Fast return of smallest integer greater than or equal to specified value.

This function is at least 5X faster than using static_cast<INT32>(ceil(x)) on Intel. Accuracy limitations on Windows 32-bit: Values in the range from -1000000 to +1000000 at exactly .0 will be handled correctly. Values outside that range may not always be correct. In addition, values in the range of -1000 to 1000 which are within 1E-10 of .0 may not be correctly rounded. The FAST_... functions should not be used if exact accuracy is required.

INT32 FAST_CEIL_NEARINT ( double  x  )  [inline]

Fast return of smallest integer greater than or equal to specified value, with near-integer adjustment.

This function is at least 5X faster than using static_cast<INT32>(ceil(x)) on Intel. Accuracy limitations on Windows 32-bit: Values in the range from -1000000 to +1000000 at exactly .0 will be handled correctly. Values outside that range may not always be correct. In addition, values in the range of -1000 to 1000 which are within 1E-10 of .0 may not be correctly rounded. The FAST_... functions should not be used if exact accuracy is required.

INT32 FAST_FLOOR ( double  x  )  [inline]

Fast return of largest integer less than or equal to specified value.

This function is at least 5X faster than using static_cast<INT32>(floor(x)) on Intel. Accuracy limitations: Accuracy limitations on Windows 32-bit: Values outside that range may not always be correct. In addition, values in the range of -1000 to 1000 which are within 1E-10 of .0 may not be correctly rounded. The FAST_... functions should not be used if exact accuracy is required.

INT32 FAST_FLOOR_NEARINT ( double  x  )  [inline]

Fast return of largest integer less than or equal to specified value, with near-integer adjustment.

This function is at least 5X faster than using static_cast<INT32>(floor(x)) on Intel. Accuracy limitations: Accuracy limitations on Windows 32-bit: Values outside that range may not always be correct. In addition, values in the range of -1000 to 1000 which are within 1E-10 of .0 may not be correctly rounded. The FAST_... functions should not be used if exact accuracy is required.

INT32 FAST_ROUND_EXACT ( double  x  )  [inline]

Fast round of value to nearest integer, with X.5 values rounded up.

This function is typically faster than using static_cast<INT32>(floor(x+.5)). No known accuracy limitations, assuming value is in valid INT32 range.

INT32 FAST_ROUND_LIMITED ( double  x  )  [inline]

Fast round (within limits) of value to nearest integer, with X.5 values rounded up.

Values less than -1000000 at exactly X.5 will be incorrectly. Values > 2 billion may be truncated. If values are known to always be positive, the FAST_ROUND_POSITIVE function will be faster.

INT32 FAST_ROUND_NOLIMIT ( double  x  )  [inline]

Fast round of value to nearest integer, with X.5 values rounded up.

This function is approximately 3X faster than using static_cast<INT32>(floor(x+.5)) on Win32. Accuracy limitations for win32: Values in the range from -1000000 to +1000000 at exactly .5 will be handled correctly. Values outside that range may not always be rounded up. In addition, values in the range of -1000 to 1000 which are within 1E-10 of .5 may not be correctly rounded down. No known accuracy limitations for non-win32: Use FAST_ROUND_EXACT if exact accuracy is required.

INT32 FAST_ROUND_POSITIVE ( double  x  )  [inline]

Fast round of positive value to nearest integer, with X.5 values rounded up.

Negative values will not be rounded correctly, this function should only be used for positive values.

INT32 FAST_TRUNCATE ( double  x  )  [inline]

Fast truncation of value toward zero.

No known accuracy limitations.

INT32 FAST_TRUNCATE_NEARINT ( double  x  )  [inline]

Fast truncation of value toward zero, with near-integer adjustment.

LIBEXPORT double IEEE_Infinity ( void   ) 

Returns the IEEE representation of Infinity.

LIBEXPORT double IEEE_NaN ( void   ) 

Returns the IEEE representation of Not A Number.

bool IsInfNeg ( double  x  )  [inline]
bool IsInfPos ( double  x  )  [inline]
bool IsNaN ( const double &  x  )  [inline]
int log2i ( INT64  value,
bool  roundup = true 
) [inline]

Compute base-2 logarithm of INT64 value.

Returns:
base-2 logarithm (0-63) or -1 if input value <= 0.
Parameters:
value Value to compute for
roundup Whether to round result up (true) or down (false)
int log2i ( UINT64  value,
bool  roundup = true 
)

Compute base-2 logarithm of UINT64 value.

Returns:
base-2 logarithm (0-64) or -1 if input value is 0.
Parameters:
value Value to compute for
roundup Whether to round result up (true) or down (false)
int log2i ( INT32  value,
bool  roundup = true 
) [inline]

Compute base-2 logarithm of INT32 value.

Returns:
base-2 logarithm (0-31) or -1 if input value <= 0.
Parameters:
value Value to compute for
roundup Whether to round result up (true) or down (false)
int log2i ( UINT32  value,
bool  roundup = true 
)

Compute base-2 logarithm of UINT32 value.

Returns:
base-2 logarithm (0-32) or -1 if input value is 0.
Parameters:
value Value to compute for
roundup Whether to round result up (true) or down (false)

Generated on Sun Oct 7 21:33:03 2012 for TNTsdk 2012 by  doxygen 1.6.1