Created
June 18, 2015 20:54
-
-
Save jgigault/07d5d0bc37e92f85a396 to your computer and use it in GitHub Desktop.
Revisions
-
Jean-Michel Gigault renamed this gist
Jun 18, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Jean-Michel Gigault created this gist
Jun 18, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ #ifndef FIXED_CLASS_HPP # define FIXED_CLASS_HPP # include <iostream> 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