casacore
|
#include <Math.h>
Public Member Functions | |
Float | pow (Float f1, Double f2) |
Returns f1**f2. More... | |
Float | pow (Double f1, Float f2) |
Int | pow (Int f1, Int f2) |
Int | ifloor (Float point) |
Return the integer "less than" point (i.e. More... | |
Int | ifloor (Double point) |
Int | max (Int a, Int b) |
Functions to get the max or min of two numbers. More... | |
Int | min (Int a, Int b) |
uInt | max (uInt a, uInt b) |
uInt | min (uInt a, uInt b) |
uInt64 | max (uInt64 a, uInt64 b) |
uInt64 | min (uInt64 a, uInt64 b) |
Double | max (Double a, Double b) |
Double | min (Double a, Double b) |
Double | max (Double a, Float b) |
Double | min (Double a, Float b) |
Double | max (Float a, Double b) |
Double | min (Float a, Double b) |
Float | max (Float a, Float b) |
Float | min (Float a, Float b) |
Int | square (Int val) |
Return the square of a value. More... | |
Int64 | square (Int64 val) |
Float | square (Float val) |
Double | square (Double val) |
Int | cube (Int val) |
Return the cube of a value. More... | |
Int64 | cube (Int64 val) |
Float | cube (Float val) |
Double | cube (Double val) |
Int | sign (Int val) |
Return the sign of a value. More... | |
Int64 | sign (Int64 val) |
Float | sign (Float val) |
Double | sign (Double val) |
Int | floormod (Int x, Int y) |
Return the floor modulo as used by Python (unlike C); divisor sign is used. More... | |
Int64 | floormod (Int64 x, Int64 y) |
Float | floormod (Float x, Float y) |
Double | floormod (Double x, Double y) |
Bool | near (uInt val1, uInt val2, Double tol=1.0e-5) |
Functions to return whether a value is "relatively" near another. More... | |
Bool | near (Int val1, Int val2, Double tol=1.0e-5) |
Bool | near (Float val1, Float val2, Double tol=1.0e-5) |
Bool | near (Float val1, Double val2, Double tol=1.0e-5) |
Bool | near (Double val1, Float val2, Double tol=1.0e-5) |
Bool | near (Double val1, Double val2, Double tol=1.0e-13) |
Bool | allNear (uInt val1, uInt val2, Double tol=1.0e-5) |
The "allNear" versions are aliases for the normal "near" versions. More... | |
Bool | allNear (Int val1, Int val2, Double tol=1.0e-5) |
Bool | allNear (Float val1, Double val2, Double tol=1.0e-5) |
Bool | allNear (Double val1, Float val2, Double tol=1.0e-5) |
Bool | allNear (Float val1, Float val2, Double tol=1.0e-5) |
Bool | allNear (Double val1, Double val2, Double tol=1.0e-13) |
Bool | nearAbs (uInt val1, uInt val2, Double tol=1.0e-5) |
Functions to return whether a value is "absolutely" near another. More... | |
Bool | nearAbs (Int val1, Int val2, Double tol=1.0e-5) |
Bool | nearAbs (Float val1, Float val2, Double tol=1.0e-5) |
Bool | nearAbs (Float val1, Double val2, Double tol=1.0e-5) |
Bool | nearAbs (Double val1, Float val2, Double tol=1.0e-5) |
Bool | nearAbs (Double val1, Double val2, Double tol=1.0e-13) |
Bool | allNearAbs (uInt val1, uInt val2, uInt tol=1) |
The "allNearAbs" versions are aliases for the normal "nearAbs" versions. More... | |
Bool | allNearAbs (Int val1, Int val2, Int tol=1) |
Bool | allNearAbs (Float val1, Float val2, Double tol=1.0e-5) |
Bool | allNearAbs (Float val1, Double val2, Double tol=1.0e-5) |
Bool | allNearAbs (Double val1, Float val2, Double tol=1.0e-5) |
Bool | allNearAbs (Double val1, Double val2, Double tol=1.0e-13) |
Bool | isFinite (const Float &val) |
Functions to test if a floating point number is finite. More... | |
Bool | isFinite (const Double &val) |
Bool | isNaN (const Float &val) |
Functions to test for IEEE NaN's. More... | |
Bool | isNaN (Double val) |
Double | roundDouble (Double val, Double ndigit=2.5) |
Round a number to ndigit significant digits, usually used for formatting for printing. More... | |
Float | floatNaN () |
Functions that return IEEE NaN's. More... | |
Double | doubleNaN () |
void | setNaN (Float &val) |
void | setNaN (Double &val) |
Bool | isInf (Float val) |
Functions to test for IEEE Infinity's. More... | |
Bool | isInf (Double val) |
Float | floatInf () |
Functions that return an IEEE Infinity, (positive infinity). More... | |
Double | doubleInf () |
void | setInf (Float &val) |
void | setInf (Double &val) |
Casacore interface to math.h and other scalar math functions
Casacore interface to <math.h>
. You should include this file rather than <math.h>
directly. It will be used to cover up any deficiencies in the system <math.h>
.
This file does not include things like element-by-element array operations. See the ArrayMath functions for these functions.
This file includes the standard math library. Hence besides the functions defined here the following functions are also available.
This file also includes the standard C library (stdlib.h). This is to obtain a definition of the following functions.
|
inline |
The "allNear" versions are aliases for the normal "near" versions.
They exist to make template functions that work for both arrays and scalars easier to write. These functions should be moved to ArrayMath.h
Definition at line 250 of file Math.h.
References near().
|
inline |
The "allNearAbs" versions are aliases for the normal "nearAbs" versions.
They exist to make template functions that work for both arrays and scalars easier to write. These functions should be in ArrayMath.h
Definition at line 279 of file Math.h.
References nearAbs().
Double casacore::Math_global_functions_Math_interface_for_casacore::doubleInf | ( | ) |
Double casacore::Math_global_functions_Math_interface_for_casacore::doubleNaN | ( | ) |
Float casacore::Math_global_functions_Math_interface_for_casacore::floatInf | ( | ) |
Functions that return an IEEE Infinity, (positive infinity).
Float casacore::Math_global_functions_Math_interface_for_casacore::floatNaN | ( | ) |
Functions that return IEEE NaN's.
The specific NaN returned has all bits set. This is 'quiet' NaN, and because the sign bit is set it may be considered a negative number (but NaN's are not numbers!).
|
inline |
Definition at line 225 of file Math.h.
References casacore::fmod().
|
inline |
Definition at line 219 of file Math.h.
References casacore::fmod().
|
inline |
Definition at line 305 of file Math.h.
References casacore::arrays_internal::isfinite().
|
inline |
Functions to test if a floating point number is finite.
It is if it is NaN nor infinity.
Definition at line 297 of file Math.h.
References casacore::arrays_internal::isfinite().
Functions to test for IEEE Infinity's.
Should work for positive or negative infinity.
Definition at line 324 of file Math.h.
References casacore::arrays_internal::isnan().
Bool casacore::Math_global_functions_Math_interface_for_casacore::near | ( | Double | val1, |
Double | val2, | ||
Double | tol = 1.0e-13 |
||
) |
Bool casacore::Math_global_functions_Math_interface_for_casacore::near | ( | Double | val1, |
Float | val2, | ||
Double | tol = 1.0e-5 |
||
) |
Bool casacore::Math_global_functions_Math_interface_for_casacore::near | ( | Float | val1, |
Double | val2, | ||
Double | tol = 1.0e-5 |
||
) |
Bool casacore::Math_global_functions_Math_interface_for_casacore::near | ( | Float | val1, |
Float | val2, | ||
Double | tol = 1.0e-5 |
||
) |
Bool casacore::Math_global_functions_Math_interface_for_casacore::near | ( | Int | val1, |
Int | val2, | ||
Double | tol = 1.0e-5 |
||
) |
Bool casacore::Math_global_functions_Math_interface_for_casacore::near | ( | uInt | val1, |
uInt | val2, | ||
Double | tol = 1.0e-5 |
||
) |
Functions to return whether a value is "relatively" near another.
Returns tol > abs(val2 - val1)/max(abs(val1),(val2))
. If tol <= 0, returns val1 == val2. If either val is 0.0, take care of area around the minimum number that can be represented.
Referenced by allNear().
Bool casacore::Math_global_functions_Math_interface_for_casacore::nearAbs | ( | Double | val1, |
Double | val2, | ||
Double | tol = 1.0e-13 |
||
) |
Bool casacore::Math_global_functions_Math_interface_for_casacore::nearAbs | ( | Double | val1, |
Float | val2, | ||
Double | tol = 1.0e-5 |
||
) |
Bool casacore::Math_global_functions_Math_interface_for_casacore::nearAbs | ( | Float | val1, |
Double | val2, | ||
Double | tol = 1.0e-5 |
||
) |
Bool casacore::Math_global_functions_Math_interface_for_casacore::nearAbs | ( | Float | val1, |
Float | val2, | ||
Double | tol = 1.0e-5 |
||
) |
Bool casacore::Math_global_functions_Math_interface_for_casacore::nearAbs | ( | Int | val1, |
Int | val2, | ||
Double | tol = 1.0e-5 |
||
) |
Bool casacore::Math_global_functions_Math_interface_for_casacore::nearAbs | ( | uInt | val1, |
uInt | val2, | ||
Double | tol = 1.0e-5 |
||
) |
Functions to return whether a value is "absolutely" near another.
Returns tol > abs(val2 - val1)
Referenced by allNearAbs().
|
inline |
Definition at line 143 of file Math.h.
References casacore::pow().
|
inline |
Returns f1**f2.
The Double precision version is defined in the standard library. But many compilers are not good enough to automatically do the type promotion. Hence these functions are explicitly defined.
Definition at line 142 of file Math.h.
References casacore::pow().
Definition at line 144 of file Math.h.
References casacore::pow().
Double casacore::Math_global_functions_Math_interface_for_casacore::roundDouble | ( | Double | val, |
Double | ndigit = 2.5 |
||
) |
Round a number to ndigit
significant digits, usually used for formatting for printing.
A non-integer ndigit=N+F<src>, with integer N and fraction F, is interpreted as follows. For <src>x = A*10^B
, where B is an integer, A is rounded to N digits if A > 10^F
, otherwise N+1 digits.
For the default 2.5, a value of 32157 is rounded to 32000, while 22157 is rounded to 22200.
void casacore::Math_global_functions_Math_interface_for_casacore::setInf | ( | Double & | val | ) |
void casacore::Math_global_functions_Math_interface_for_casacore::setInf | ( | Float & | val | ) |
void casacore::Math_global_functions_Math_interface_for_casacore::setNaN | ( | Double & | val | ) |
void casacore::Math_global_functions_Math_interface_for_casacore::setNaN | ( | Float & | val | ) |