#ifndef FIXED_CLASS_HPP # define FIXED_CLASS_HPP # include class Fixed { public: Fixed(void); ~Fixed(void); Fixed(Fixed const & src); Fixed(int const i); Fixed(float const i); Fixed & operator=(Fixed const & rhs); bool operator>(Fixed const & rhs); bool operator<(Fixed const & rhs); bool operator>=(Fixed const & rhs); bool operator<=(Fixed const & rhs); bool operator==(Fixed const & rhs); bool operator!=(Fixed const & rhs); Fixed operator+(Fixed const & rhs); Fixed operator-(Fixed const & rhs); Fixed operator*(Fixed const & rhs); Fixed operator/(Fixed const & rhs); Fixed & operator++(void); Fixed & operator--(void); Fixed operator++(int n); Fixed operator--(int n); int getRawBits(void) const; void setRawBits(int const raw); int toInt(void) const; float toFloat(void) const; static Fixed & min(Fixed & i, Fixed & j); static Fixed & max(Fixed & i, Fixed & j); static Fixed const & min(Fixed const & i, Fixed const & j); static Fixed const & max(Fixed const & i, Fixed const & j); static int pow(int const n, int p); static int rpow(int const n, int p); static float fpow(float const f, int p); static float rfpow(float const f, int p); private: int _value; static int const f = 8; static int const accuracy = 128; }; std::ostream & operator<<(std::ostream & o, Fixed const & i); #endif