#include <boundednumber.h>
See the Integer class for more details.
The template can be instantiated for any floating-point type smaller than or equal to type LargeFloat.
Unfortunately, because the C++ standard explicitly disallows floating-point template literal arguments (without giving any rationale!), the MaxVal and MinVal must always be integers representable in type LargeInt, even though the underlying type is floating-point. Luckily bounds are usually integers anyway.
Definition at line 130 of file boundednumber.h.
Public Methods | |
Float () | |
Default constructor. | |
Float (value_type val) | |
Constructs using specified value. | |
Float (const Float< T, MaxVal, MinVal, Boundary > &other) | |
Copy constructor. | |
template<class OT, LargeInt OMaxVal, LargeInt OMinVal, class OBoundary> | Float (const Integer< OT, OMaxVal, OMinVal, OBoundary > &other) |
Construct from a Bounded::Integer. | |
void | operator= (const LargeFloat &val) |
Set to a numeric value; assumes LargeFloat is an encompassing type. | |
Magnitude | mag () const |
Returns the current numeric value as a fraction of the maximum. | |
value_type | raw () const |
Returns the current numeric value in the native units. | |
Static Public Attributes | |
const value_type | Min = MinVal |
Minimum legal value. | |
const value_type | Max = MaxVal |
Maximum legal value. |