[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Blitz++ provides a set of functions to access numeric properties of
intrinsic types. They are provided as an alternative to the somewhat klunky
numeric_limits<T>::yadda_yadda
syntax provided by the ISO/ANSI C++
standard. Where a similar Fortran 90 function exists, the same name has
been used.
The argument in all cases is a dummy of the appropriate type.
All functions described in this section assume that numeric_limits<T>
has been specialized for the appropriate case. If not, the results are not
useful. The standard requires that numeric_limits<T>
be specialized
for all the intrinsic numeric types (float, double, int, bool, unsigned int,
etc.).
To use these functions, you must first include the header
<blitz/numinquire.h>
. Also, note that these functions may be
unavailable if your compiler is non-ANSI compliant. If the preprocessor
symbol BZ_HAVE_NUMERIC_LIMITS
is false, then these functions are
unavailable.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
T denorm_min(T) throw;
int digits(T);
int digits10(T);
T epsilon(T);
bool has_denorm(T);
bool has_denorm_loss(T);
bool has_infinity(T);
infinity(T)
.
bool has_quiet_NaN(T);
NaN
). If so, use the function quiet_NaN(T)
to obtain it.
bool has_signaling_NaN(T);
NaN
). If so, use the function signalling_NaN(T)
to obtain it.
bool has_signalling_NaN(T);
has_signaling_NaN()
.
T huge(T) throw;
CHAR_MAX
, SHRT_MAX
, FLT_MAX
, etc. For floating types
with denormalization, the maximum positive normalized value is
returned.
T infinity(T) throw;
has_infinity(T)
before calling
this function.
bool is_bounded(T);
bool is_exact(T);
bool is_iec559(T);
bool is_integer(T);
bool is_modulo(T);
bool is_signed(T);
int max_exponent(T);
Max_exp
) is the maximum positive integer such
that the radix (read: 2) raised to the power Max_exp-1
is a
representable, finite floating point number. Floating types only.
int max_exponent10(T);
Max_exp10
) is the maximum positive
integer such that 10 raised to the power Max_exp10
is a
representable, finite floating point number. Floating types only.
int min_exponent(T);
Min_exp
) is the minimum negative integer such
that the radix (read: 2) raised to the power Min_exp-1
is a
normalized floating point number. Floating types only.
int min_exponent10(T);
Min_exp10
) is the minimum negative integer
such that 10 raised to the power Min_exp10
is in the range of
normalized floating point numbers.
T neghuge(T);
-huge(T())
.
T one(T);
int precision(T);
digits10()
.
T quiet_NaN(T) throw;
NaN
), if available. You should check availability using the
has_quiet_NaN(T)
function first.
int radix(T);
Range range(T);
Range(min_exponent10(T()), max_exponent10(T()))
, i.e. the
range of representable base-10 exponents.
T round_error(T) throw;
0.5
.
std::float_round_style round_style(T);
round_indeterminate
(i.e. don't have a clue),
round_toward_zero
, round_to_nearest
(round to nearest
representable value), round_toward_infinity
(round toward positive
infinity), and round_neg_infinity
(round toward negative infinity).
T signaling_NaN(T) throw;
NaN
), if
available. You should check availability by calling
has_signalling_NaN(T)
first.
T signalling_NaN(T) throw;
signaling_NaN()
.
T tiny(T);
T tinyness_before(T);
T traps(T);
T zero(T);
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |