68 bool read(std::istream& strm);
fixed & operator*=(fixed f)
Multiplication assignment operator.
Implement a fixed-point number class. Values have places places after the decimal point...
fixed operator*(fixed a, fixed b)
Multiply fixed values.
std::string as_string() const
bool operator>=(fixed a, fixed b)
Compare fixed values for greater-than-or-equal by comparing the underlying values.
bool operator<=(fixed a, fixed b)
Compare fixed values for less-than-or-equal by comparing the underlying values.
bool operator<(fixed a, fixed b)
Compare fixed values for less-than by comparing the underlying values.
value_type value() const
Return the internal value.
value_type integer() const
Return the integer part (which is the same as trunc()).
double as_double() const
Convert to double.
std::ostream & operator<<(std::ostream &strm, fixed f)
Write a fixed value.
value_type fraction() const
Return the fractional part, e.g., 3 for 12.03.
bool operator!=(fixed a, fixed b)
Compare fixed values for inequality by comparing the underlying values.
static int const places
number of decimal places
bool operator>(fixed a, fixed b)
Compare fixed values for greater-than by comparing the underlying values.
fixed & operator++()
Pre-increment.
fixed & operator+=(fixed f)
Addition assignment operator.
float as_float() const
Convert to float.
fixed & operator/=(fixed f)
Division assignment operator.
double as_long_double() const
Convert to long double.
fixed & operator--()
Pre-decrement.
fixed operator/(fixed a, fixed b)
Divide fixed values.
void negate()
Negate this value.
fixed & operator-=(fixed f)
Subtraction assignment operator.
std::istream & operator>>(std::istream &strm, fixed &f)
Read a fixed value.
bool operator==(fixed a, fixed b)
Compare fixed values for equality by comparing the underlying values.
static value_type const places10
10places
fixed operator-(fixed a, fixed b)
Subtract fixed values.
int value_type
Type of the actual value.
fixed(double value)
Construct by rounding off a floating point number.
fixed operator+(fixed a, fixed b)
Add fixed values.
fixed()
Default constructor initializes to zero.
bool read(std::istream &strm)