Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

numeric_limits


Numeric Limits Library

Summary

A class for representing information about scalar types.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Specializations

numeric_limits<float>
numeric_limits<double>
numeric_limits<long double>
numeric_limits<short>
numeric_limits<unsigned short>
numeric_limits<int>
numeric_limits<unsigned int>
numeric_limits<long>
numeric_limits<unsigned long>
numeric_limits<char>
numeric_limits<wchar_t>
numeric_limits<unsigned char>
numeric_limits<signed char>
numeric_limits<bool>

Synopsis

#include <limits>
template <class T>
class numeric_limits ;

Description

numeric_limits is a class for representing information about scalar types. Specializations are included for each fundamental type, both floating point and integer, including bool.

This class encapsulates information that is contained in the <climits> and <cfloat> headers, and includes additional information that is not contained in any existing C or C++ header.

Not all of the information given by members is meaningful for all specializations of numeric_limits. Any value that is not meaningful for a particular type is set to 0 or false.

Interface

template <class T>
 class numeric_limits {

 public:

 // General -- meaningful for all specializations.

    static const bool is_specialized ;
    static T min () throw();
    static T max () throw();
    static const int radix ;
    static const int digits ;
    static const int digits10 ;
    static const bool is_signed ;
    static const bool is_integer ;
    static const bool is_exact ;
    static const bool traps ;
    static const bool is_modulo ;
    static const bool is_bounded ;

 // Floating point specific.

    static T epsilon () throw();
    static T round_error () throw();
    static const int min_exponent10 ;
    static const int max_exponent10 ;
    static const int min_exponent ;
    static const int max_exponent ;
    static const bool has_infinity ;
    static const bool has_quiet_NaN ;
    static const bool has_signaling_NaN ;
    static const bool is_iec559 ;
    static const float_denorm_style has_denorm ;
    static const bool has_denorm_loss;
    static const bool tinyness_before ;
    static const float_round_style round_style ;
    static T denorm_min () throw();
    static T infinity () throw();
    static T quiet_NaN () throw();
    static T signaling_NaN () throw();
 };

 enum float_round_style {
   round_indeterminate       = -1,
   round_toward_zero         =  0,
   round_to_nearest          =  1,
   round_toward_infinity     =  2,
   round_toward_neg_infinity =  3
 };
 enum float_denorm_style {
   denorm_indeterminate      = -1,
   denorm_absent             =  0,
   denorm_present            =  1
 };

Member Fields and Functions

static T 
denorm_min () throw();
static const int 
digits ;
static const int 
digits10 ;
static T 
epsilon () throw();
static const float_denorm_style 
has_denorm ;
static const bool 
has_infinity ;
static const bool 
has_quiet_NaN ;
static const bool 
has_signaling_NaN ;
static T 
infinity () throw();
static const bool 
is_bounded ;
static const bool 
is_exact ;
static const bool 
is_iec559 ;
static const bool 
is_integer ;
static const bool 
is_modulo ;
static const bool 
is_signed ;
static const bool 
is_specialized ;
static T
max () throw();
static const int 
max_exponent ;
static const int 
max_exponent10 ;
static T 
min () throw();
static const int 
min_exponent ;
static const int 
min_exponent10 ;
static T 
quiet_NaN () throw();
static const int 
radix ;
static T 
round_error () throw();
static const float_round_style 
round_style ;
static T 
signaling_NaN() throw();
static const bool 
tinyness_before ;
static const bool 
traps ;

Example

Warnings

The specializations for wide chars and bool are only available if your compiler has implemented them as real types and not simulated them with typedefs.

If your compiler does not support namespaces, then you do not need the using declaration for std.

See Also

IEEE Standard for Binary Floating-Point Arithmetic, 345 East 47th Street, New York, NY 10017

Language Independent Arithmetic (LIA-1)



Previous fileTop of documentContentsIndexNext file
©Copyright 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.
OEM Release, June 1998