class Number
Required header: <Eclog/Number.h>
The Number class represents a number.
Name | Description |
---|---|
UnderlyingType | Underlying type. |
Name | Description |
---|---|
(constructor) | Constructor. |
underlyingType | Gets the underlying type of this number. |
sign | Determines the sign of this number. |
isSubnormal | Determines whether this number is subnormal. |
isInfinity | Determines whether this number is a positive or negative infinity. |
isNan | Determines whether this number is a NaN. |
operator= | Assigns a new value to this number. |
load | Gets the value from this number. |
store | Assigns a new value to this number. |
operator== | Compares this number with another number. |
operator!= | Compares this number with another number. |
operator< | Compares this number with another number. |
operator> | Compares this number with another number. |
operator<= | Compares this number with another number. |
operator>= | Compares this number with another number. |
Name | Description |
---|---|
operator== | Compares two numbers. |
operator!= | Compares two numbers. |
operator< | Compares two numbers. |
operator> | Compares two numbers. |
operator<= | Compares two numbers. |
operator>= | Compares two numbers. |
operator<< | Insert number into stream. |
enum UnderlyingType
underlying_type_double
Underlying type:
double
.
underlying_type_int
Underlying type:
int
.
underlying_type_uint
Underlying type:
unsigned int
.
underlying_type_long
Underlying type:
long
.
underlying_type_ulong
Underlying type:
unsigned long
.
underlying_type_llong
Underlying type:
long long
.
underlying_type_ullong
Underlying type:
unsigned long long
.
Number();
Number(double value);
Number(int value);
Number(long value);
Number(long long value);
Number(unsigned int value);
Number(unsigned long value);
Number(unsigned long long value);
Constructs a Number.
(numeric type) value A numeric value.
UnderlyingType underlyingType() const;
Gets the underlying type of this number.
UnderlyingType
The underlying type.
int sign() const;
Determines the sign of this number.
int
1 for positive, -1 for negative.
bool isSubnormal() const;
Determines whether this number is subnormal.
bool
true if this number is subnormal, false otherwise.
bool isInfinity() const;
Determines whether this number is a positive or negative infinity.
bool
true if this number is infinite, false otherwise.
bool isNan() const;
Determines whether this number is a NaN.
bool
true if this number is a NaN, false otherwise.
Number& operator=(double value);
Number& operator=(int value);
Number& operator=(long value);
Number& operator=(long long value);
Number& operator=(unsigned int value);
Number& operator=(unsigned long value);
Number& operator=(unsigned long long value);
Assigns a new value to this number.
(numeric type) value A numeric value.
Number&
Reference to *this
.
template<typename T>
T load() const;
Gets the value from this number.
Numeric promotion or numeric conversion happens if the underlying type is different from the specified type.
T
The numeric type to convert to.
T
The value.
void store(double value);
void store(int value);
void store(long value);
void store(long long value);
void store(unsigned int value);
void store(unsigned long value);
void store(unsigned long long value);
Assigns a new value to this number.
(numeric type) value A numeric value.
bool operator==(const Number& other) const;
bool operator!=(const Number& other) const;
bool operator<(const Number& other) const;
bool operator>(const Number& other) const;
bool operator<=(const Number& other) const;
bool operator>=(const Number& other) const;
Compares this number with another number.
const
Number&
other Another number.
bool
true if the corresponding comparison holds, false otherwise.
template<typename T>
bool operator==(const T& a, const Number& b);
template<typename T>
bool operator!=(const T& a, const Number& b);
template<typename T>
bool operator<(const T& a, const Number& b);
template<typename T>
bool operator>(const T& a, const Number& b);
template<typename T>
bool operator<=(const T& a, const Number& b);
template<typename T>
bool operator>=(const T& a, const Number& b);
Compares two numbers.
const T&
a A number to compare.
const
Number&
b A number to compare.
bool
true if the corresponding comparison holds, false otherwise.
std::ostream& operator<<(std::ostream& stream, const Number& n);
Insert number into stream.
std::ostream&
stream The stream where number is inserted.
const
Number&
n The number to insert.
std::ostream&
The same as parameter stream.