/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Fixed.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/11/09 19:23:08 by adjoly #+# #+# */ /* Updated: 2024/11/20 12:40:10 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ #pragma once #include class Fixed { private: int _number; static const int _fractBit = 8; public: Fixed(void); Fixed(const int nbr); Fixed(const float nbr); Fixed(const Fixed& cpy); Fixed& operator=(const Fixed&); float operator+(const Fixed&); float operator-(const Fixed&); float operator*(const Fixed&); float operator/(const Fixed&); bool operator<(const Fixed&) const; bool operator>(const Fixed&) const; bool operator<=(const Fixed&) const; bool operator>=(const Fixed&) const; bool operator==(const Fixed&) const; bool operator!=(const Fixed&) const; Fixed& operator--(void); Fixed operator--(int); Fixed& operator++(void); Fixed operator++(int); static Fixed& min(Fixed& fst, Fixed& scnd); static Fixed& max(Fixed& fst, Fixed& scnd); static const Fixed& min(const Fixed& fst, const Fixed& scnd); static const Fixed& max(const Fixed& fst, const Fixed& scnd); ~Fixed(void); int toInt(void) const; float toFloat(void) const; int getRawBits( void ) const; void setRawBits( int const raw ); }; std::ostream &operator<<(std::ostream &file, Fixed const &fixed);