Evo C++ Library v0.5.1
|
#include <evo/type.h>
Nullable basic floating-point base type.
T | Floating-point type |
Floating point types:
Examples – using Float type (and float type) here, other supported floating point types work the same:
Public Types | |
typedef void | EvoNullableType |
Identify as nullable type. More... | |
typedef FloatT< T > | This |
This non-POD type More... | |
typedef T | Type |
Wrapped POD type. More... | |
Public Member Functions | |
FloatT () | |
Constructor. More... | |
FloatT (const FloatT< T > &val) | |
Copy constructor. More... | |
FloatT (T val) | |
Constructor. More... | |
int | compare (const Nullable< T > &val) const |
Comparison. More... | |
int | compare (T val) const |
Comparison. More... | |
T & | denull () |
Clears null flag and returns value reference. More... | |
bool | eq1 (const Nullable< T > &val) |
Get whether approximately equal to given value. More... | |
bool | eq1 (T val) |
Get whether approximately equal to given value. More... | |
bool | null () const |
Get whether null. More... | |
operator SafeBoolType () const | |
Safe (explicit) evaluation as bool type. More... | |
bool | operator! () const |
Negation operator returns whether null or 0. More... | |
bool | operator!= (const Nullable< T > &val) const |
Inequality operator. More... | |
bool | operator!= (T val) const |
Inequality operator. More... | |
const T & | operator* () const |
Dereference for explicit conversion to underlying type (const). More... | |
T & | operator* () |
Dereference for explicit conversion to underlying type. More... | |
bool | operator< (const Nullable< T > &val) const |
Less than operator. More... | |
bool | operator< (T val) const |
Less than operator. More... | |
bool | operator<= (const Nullable< T > &val) const |
Less than or equal operator. More... | |
bool | operator<= (T val) const |
Less than or equal operator. More... | |
FloatT< T > & | operator= (const FloatT< T > &val) |
Assignment operator. More... | |
FloatT< T > & | operator= (T val) |
Assignment operator. More... | |
FloatT< T > & | operator= (ValNull) |
Assignment operator to set as null. More... | |
bool | operator== (const Nullable< T > &val) const |
Equality operator. More... | |
bool | operator== (T val) const |
Equality operator. More... | |
bool | operator> (const Nullable< T > &val) const |
Greater than operator. More... | |
bool | operator> (T val) const |
Greater than operator. More... | |
bool | operator>= (const Nullable< T > &val) const |
Greater than or equal operator. More... | |
bool | operator>= (T val) const |
Greater than or equal operator. More... | |
Nullable< T > & | set () |
Set as null. More... | |
Nullable< T > & | set (const Nullable< T > &src) |
Set as copy of given value. More... | |
Nullable< T > & | set (T src) |
Set as given value. More... | |
bool | valid () const |
Get whether valid (not null). More... | |
const T & | value () const |
Get underlying value (const). More... | |
T & | value () |
Get underlying value. More... | |
T | value (T defval) const |
Get underlying value or given default if null. More... | |
Static Public Member Functions | |
static T | eps () |
Get machine epsilon. More... | |
static bool | eq (T val1, T val2) |
Get whether values are approximately equal. More... | |
static bool | eq (T val1, T val2, T eps) |
Get whether values are approximately equal using given epsilon value. More... | |
static T | exp10 (T num, int exp) |
Multiply number by 10 raised to exponent. More... | |
static T | fexp10 (int &exp, T num) |
Extract normalized base 10 mantissa and exponent from number. More... | |
static T | inf () |
Get infinity value. More... | |
static bool | inf (T num) |
Check whether value is infinite. More... | |
static T | max () |
Get maximum normalized value. More... | |
static int | maxdigits_prec (int exp, int precision) |
Get max formatting digits with given exponent and precision, including sign and any additional chars (used internally). More... | |
static int | maxexp () |
Get maximum allowed exponent. More... | |
static T | min () |
Get minimum normalized value. More... | |
static int | minexp () |
Get minimum allowed exponent. More... | |
static bool | nan (T num) |
Get whether value is Not-A-Number (NaN). More... | |
static T | nan () |
Get Not-A-Number (NaN) value. More... | |
static T | precision () |
Get best precision value. More... | |
Static Public Attributes | |
static const int | BYTES = sizeof(T) |
Type size in bytes. More... | |
static const bool | IS = IsFloat<T>::value |
Whether type is really a floating point type. More... | |
static const int | MAXDIGITS = std::numeric_limits<T>::digits10 |
Maximum significant digits without precision loss. More... | |
static const int | MAXDIGITS_AUTO = MAXDIGITS + 15 |
Max formatting digits with auto precision (used internally) More... | |
static const bool | NANOK = std::numeric_limits<T>::has_quiet_NaN |
Whether Not-A-Number (NaN) is supported. More... | |
static const bool | SIGN = true |
Whether type is signed. More... | |
|
inherited |
Identify as nullable type.
typedef T Type |
Wrapped POD type.
|
inline |
Constructor.
|
inline |
Constructor.
val | Value to set |
|
inlineinherited |
Comparison.
val | Value to compare to |
|
inlineinherited |
Comparison.
val | Value to compare to |
|
inlineinherited |
Clears null flag and returns value reference.
Nullable<bool>
template specialization returns by value instead of reference
|
inlinestatic |
Get machine epsilon.
This is the difference between 1 and the least value greater than 1 that is representable.
|
inlinestatic |
Get whether values are approximately equal.
val1 | First value to compare |
val2 | Second value to compare |
|
inlinestatic |
Get whether values are approximately equal using given epsilon value.
val1 | First value to compare |
val2 | Second value to compare |
eps | Epsilon value to use for comparison – values are approximately equal if difference <= eps |
|
inline |
Get whether approximately equal to given value.
val | Value to compare to |
|
inline |
Get whether approximately equal to given value.
val | Value to compare to |
|
inlinestatic |
Multiply number by 10 raised to exponent.
num | Number to multiply |
exp | Exponent to use |
|
inlinestatic |
Extract normalized base 10 mantissa and exponent from number.
exp | Stores exponent value [out] |
num | Number to use |
|
inlinestatic |
Get infinity value.
|
inlinestatic |
Check whether value is infinite.
|
inlinestatic |
Get maximum normalized value.
|
inlinestatic |
Get max formatting digits with given exponent and precision, including sign and any additional chars (used internally).
|
inlinestatic |
Get maximum allowed exponent.
|
inlinestatic |
Get minimum normalized value.
|
inlinestatic |
Get minimum allowed exponent.
|
inlinestatic |
Get whether value is Not-A-Number (NaN).
|
inlinestatic |
Get Not-A-Number (NaN) value.
|
inlineinherited |
Get whether null.
|
inlineinherited |
Safe (explicit) evaluation as bool type.
|
inlineinherited |
Negation operator returns whether null or 0.
Inequality operator.
val | Value to compare to |
|
inlineinherited |
Inequality operator.
val | Value to compare to |
|
inlineinherited |
Dereference for explicit conversion to underlying type (const).
Alternative to value().
|
inlineinherited |
Dereference for explicit conversion to underlying type.
Alternative to value().
|
inlineinherited |
Less than operator.
val | Value to compare to |
val
|
inlineinherited |
Less than operator.
val | Value to compare to |
val
|
inlineinherited |
Less than or equal operator.
val | Value to compare to |
val
, true if null
|
inlineinherited |
Less than or equal operator.
val | Value to compare to |
val
, true if null Assignment operator.
val | Value to copy |
|
inline |
Assignment operator.
val | Value to set |
|
inlineinherited |
Equality operator.
val | Value to compare to |
|
inlineinherited |
Equality operator.
val | Value to compare to |
|
inlineinherited |
Greater than operator.
val | Value to compare to |
val
, false if null
|
inlineinherited |
Greater than operator.
val | Value to compare to |
val
, false if null
|
inlineinherited |
Greater than or equal operator.
val | Value to compare to |
val
|
inlineinherited |
Greater than or equal operator.
val | Value to compare to |
val
|
inlinestatic |
Get best precision value.
|
inlineinherited |
Set as null.
Set as copy of given value.
src | Source to copy |
|
inlineinherited |
Set as given value.
src | Source to set |
|
inlineinherited |
Get whether valid (not null).
|
inlineinherited |
|
inlineinherited |
|
inline |
Get underlying value or given default if null.
defval | Default value to use if null |
|
static |
Type size in bytes.
|
static |
Maximum significant digits without precision loss.
|
static |
Max formatting digits with auto precision (used internally)
|
static |
Whether Not-A-Number (NaN) is supported.
|
static |
Whether type is signed.