Created
June 18, 2015 20:54
-
-
Save jgigault/07d5d0bc37e92f85a396 to your computer and use it in GitHub Desktop.
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 characters
#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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment