⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 numinquire.texi

📁 A C++ class library for scientific computing
💻 TEXI
字号:
@section Introduction@cindex numeric limitsBlitz++ provides a set of functions to access numeric properties ofintrinsic types.  They are provided as an alternative to the somewhat klunky@code{numeric_limits<T>::yadda_yadda} syntax provided by the ISO/ANSI C++standard.  Where a similar Fortran 90 function exists, the same name hasbeen used.The argument in all cases is a dummy of the appropriate type.All functions described in this section assume that @code{numeric_limits<T>}has been specialized for the appropriate case.  If not, the results are notuseful.  The standard requires that @code{numeric_limits<T>} be specializedfor all the intrinsic numeric types (float, double, int, bool, unsigned int,etc.).@findex numinquire.hTo use these functions, you must first include the header@code{<blitz/numinquire.h>}.  Also, note that these functions may beunavailable if your compiler is non-ANSI compliant.  If the preprocessorsymbol @code{BZ_HAVE_NUMERIC_LIMITS} is false, then these functions areunavailable.@section Function descriptions@table @code@item T     denorm_min(T) throw;@findex denorm_min()Minimum positive denormalized value.  Available for floating-pointtypes only. @item int   digits(T);@findex digits()The number of radix digits (read: bits) in the mantissa.  Also works forinteger types.  The official definition is ``number of radix digits that canbe represented without change''. @item int   digits10(T);@findex digits10()The number of base-10 digits that can be represented withoutchange. @item T     epsilon(T);@findex epsilon()The smallest amount which can be added to 1 to produce a result which is not1.  Floating-point types only.@item bool  has_denorm(T);@cindex denormalized values@findex has_denorm()True if the representation allows denormalized values (floating-pointonly).@item bool  has_denorm_loss(T);@cindex denormalization loss @findex has_denorm_loss() True if a loss of precision is detected as a denormalization loss, ratherthan as an inexact result (floating-point only). @item bool  has_infinity(T);@cindex infinity -- @code{has_infinity()}@findex has_infinity()True if there is a special representation for the value ``infinity''.  Iftrue, the representation can be obtained by calling @code{infinity(T)}.@item bool  has_quiet_NaN(T);@findex has_quiet_NaN()@cindex NaN -- @code{has_quiet_NaN()}True if there is a special representation for a quiet (non-signalling) Not ANumber (@code{NaN}).  If so, use the function @code{quiet_NaN(T)} to obtain it. @item bool  has_signaling_NaN(T);@cindex NaN -- @code{has_signaling_NaN()}@findex has_signaling_NaN()True if there is a special representation for a signalling Not A Number(@code{NaN}).  If so, use the function @code{signalling_NaN(T)} to obtain it. @item bool  has_signalling_NaN(T);  @findex has_signalling_NaN()Same as @code{has_signaling_NaN()}.@item T     huge(T) throw;@findex huge()@cindex maximum value of a typeReturns the maximum finite representable value.  Equivalent to@code{CHAR_MAX}, @code{SHRT_MAX}, @code{FLT_MAX}, etc.  For floating typeswith denormalization, the maximum positive @strong{normalized} value isreturned.  @item T     infinity(T) throw;@findex infinity()Returns the representation of positive infinity, if available.  Note thatyou should check availability with @code{has_infinity(T)} before callingthis function. @item bool  is_bounded(T);@findex is_bounded()True if the set of values represented by the type is finite.  All built-intypes are bounded.  (This function was provided so that e.g. arbitraryprecision types could be distinguished).@item bool  is_exact(T);@findex is_exact()True if the representation is exact.  All integer types are exact;floating-point types generally aren't.  A rational arithmetic type could beexact. @item bool  is_iec559(T);@cindex IEC 559@findex is_iec559()True if the type conforms to the IEC 559 standard.  IEC is the InternationalElectrotechnical Commission.  Note that IEC 559 is the same as IEEE 754.Only relevant for floating types.@item bool  is_integer(T);@findex is_integer()True if the type is integer.  @item bool  is_modulo(T);@findex is_modulo()True if the type is modulo.  Integer types are usually modulo: if you addtwo integers, they might wrap around and give you a small result.  (Somespecial kinds of integers don't wrap around, but stop at an upper or lowerbound; this is called saturating arithmetic).  This is false for floatingtypes.  @item bool  is_signed(T);@findex is_signed()@cindex signed -- @code{is_signed()}True if the type is signed (i.e.@: can handle both positive and negativevalues).  @item int   max_exponent(T);@findex max_exponent()The maximum exponent (@code{Max_exp}) is the maximum positive integer suchthat the radix (read: 2) raised to the power @code{Max_exp-1} is arepresentable, finite floating point number.  Floating types only. @item int   max_exponent10(T);@findex max_exponent10()The maximum base-10 exponent (@code{Max_exp10}) is the maximum positiveinteger such that 10 raised to the power @code{Max_exp10} is arepresentable, finite floating point number.  Floating types only. @item int   min_exponent(T);@findex min_exponent()The minimum exponent (@code{Min_exp}) is the minimum negative integer suchthat the radix (read: 2) raised to the power @code{Min_exp-1} is a@strong{normalized} floating point number.  Floating types only. @item int   min_exponent10(T);@findex min_exponent10()The minimum base-10 exponent (@code{Min_exp10}) is the minimum negative integersuch that 10 raised to the power @code{Min_exp10} is in the range of@strong{normalized} floating point numbers. @item T     neghuge(T);@findex neghuge()@cindex maximally negative value -- @code{neghuge()}This returns the maximally negative value for a type.  For integers, this isthe same as min().  For floating-point types, it is @code{-huge(T())}.@item T     one(T);@findex one()Returns a representation for ``1''  @item int   precision(T);@findex precision()Same as @code{digits10()}. @item T     quiet_NaN(T) throw;@findex quiet_NaN()@cindex NaN -- @code{quiet_NaN()}Returns the representation for a quiet (non-signalling) Not A Number(@code{NaN}), if available.  You should check availability using the@code{has_quiet_NaN(T)} function first.  @item int   radix(T);@findex radix()For floating-point types, this returns the radix (base) of the exponent.For integers, it specifies the base of the representation.@item Range range(T);@findex range()Returns @code{Range(min_exponent10(T()), max_exponent10(T()))}, i.e.@:  therange of representable base-10 exponents.  @item T     round_error(T) throw;@findex round_error()Returns a measure of the maximum rounding error for floating-point types.This will typically be @code{0.5}. @item std::float_round_style round_style(T);@findex round_style()Returns the current rounding style for floating-point arithmetic.  Thepossibilities are: @code{round_indeterminate} (i.e.@: don't have a clue),@code{round_toward_zero}, @code{round_to_nearest} (round to nearestrepresentable value), @code{round_toward_infinity} (round toward positiveinfinity), and @code{round_neg_infinity} (round toward negative infinity).  @item T     signaling_NaN(T) throw;@findex signaling_NaN()Returns the representation for a signalling Not A Number (@code{NaN}), ifavailable.  You should check availability by calling@code{has_signalling_NaN(T)} first.  @item T     signalling_NaN(T) throw;    @findex signalling_NaN()Same as @code{signaling_NaN()}.@item T     tiny(T);@findex tiny()@cindex minimum finite value -- @code{tiny()}For integer types, this returns the minimum finite value, which may benegative.  For floating types, it returns the minimum positive value.  Forfloating types with denormalization, the function returns the minimumpositive @strong{normalized} value.  @item T     tinyness_before(T);@findex tinyness_before()True if tinyness is detected before rounding.  Other than this description,I don't have a clue what this means; anyone have a copy of IEC 559/IEEE 754floating around? @item T     traps(T);@findex traps()True if trapping is implemented for this type. @item T     zero(T);@findex zero()Returns a representation for zero. @end table

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -