--- /dev/null
+#include "Fixed.h"
+#include <cmath>
+#include <iostream>
+
+Fixed::Fixed(): m_num(0)
+{
+ std::cout << "Default constructor called\n";
+}
+
+Fixed::Fixed(const int init): m_num(init << point_pos)
+{
+ std::cout << "Int constructor called\n";
+}
+Fixed::Fixed(const float init): m_num(roundf(init * (1 << point_pos)))
+{
+ std::cout << "Float constructor called\n";
+}
+
+Fixed::Fixed(const Fixed &other)
+{
+ std::cout << "Copy constructor called\n";
+ *this = other;
+}
+
+Fixed::~Fixed()
+{
+ std::cout << "Destructor called\n";
+}
+
+Fixed &Fixed::operator=(const Fixed &other)
+{
+ std::cout << "Copy assignment operator called\n";
+ if (this == &other)
+ return (*this);
+ m_num = other.getRawBits();
+ return (*this);
+}
+
+std::ostream &operator<<(std::ostream &ostream, const Fixed &num)
+{
+ ostream << num.toFloat();
+ return (ostream);
+}
+
+int Fixed::getRawBits() const
+{
+ return (m_num);
+}
+
+void Fixed::setRawBits(int const raw)
+{
+ m_num = raw;
+}
+
+int Fixed::toInt() const
+{
+ return (m_num >> point_pos);
+}
+
+float Fixed::toFloat() const
+{
+ return (static_cast<float>(m_num) / (1 << point_pos));
+}
+
+int Fixed::operator==(const Fixed &other) const
+{
+ return (m_num == other.m_num);
+}
+
+int Fixed::operator!=(const Fixed &other) const
+{
+ return (!(*this == other));
+}
+
+int Fixed::operator>(const Fixed &other) const
+{
+ return (m_num > other.m_num);
+}
+
+int Fixed::operator<(const Fixed &other) const
+{
+ return (!(*this >= other));
+}
+
+int Fixed::operator>=(const Fixed &other) const
+{
+ return (*this == other || *this > other);
+}
+
+int Fixed::operator<=(const Fixed &other) const
+{
+ return (!(*this > other));
+}
+
+Fixed Fixed::operator+(const Fixed &other) const
+{
+ Fixed res;
+
+ res.m_num = m_num + other.m_num;
+ return (res);
+}
+
+Fixed Fixed::operator-(const Fixed &other) const
+{
+ Fixed res;
+
+ res.m_num = m_num - other.m_num;
+ return (res);
+}
+Fixed Fixed::operator*(const Fixed &other) const
+{
+ Fixed res;
+
+ res.m_num = (m_num * other.m_num) >> point_pos;
+ return (res);
+}
+
+Fixed Fixed::operator/(const Fixed &other) const
+{
+ Fixed res;
+
+ res.m_num = (m_num << point_pos) / other.m_num;
+ return (res);
+}
+
+Fixed Fixed::operator++()
+{
+ ++m_num;
+ return (*this);
+}
+
+Fixed Fixed::operator++(int)
+{
+ Fixed res = *this;
+
+ ++*this;
+ return (res);
+}
+
+Fixed Fixed::operator--()
+{
+ --m_num;
+ return (*this);
+}
+
+Fixed Fixed::operator--(int)
+{
+ Fixed res = *this;
+
+ --*this;
+ return (res);
+}
+
+Fixed &Fixed::min(Fixed &a, Fixed &b)
+{
+ return (const_cast<Fixed&>(Fixed::min(static_cast<const Fixed&>(a), b)));
+}
+
+const Fixed &Fixed::min(const Fixed &a, const Fixed &b)
+{
+ if (a > b)
+ return (b);
+ return (a);
+}
+
+Fixed &Fixed::max(Fixed &a, Fixed &b)
+{
+ return (const_cast<Fixed&>(Fixed::max(static_cast<const Fixed&>(a), b)));
+}
+
+const Fixed &Fixed::max(const Fixed &a, const Fixed &b)
+{
+ if (a > b)
+ return (a);
+ return (b);
+}
--- /dev/null
+#ifndef FIXED_H
+# define FIXED_H
+
+# include <iostream>
+
+class Fixed
+{
+ private:
+ static const int point_pos = 8;
+ int m_num;
+
+ public:
+ Fixed();
+ Fixed(const int init);
+ Fixed(const float init);
+ Fixed(const Fixed &other);
+ ~Fixed();
+
+ Fixed &operator=(const Fixed &other);
+
+ int operator==(const Fixed &other) const;
+ int operator!=(const Fixed &other) const;
+ int operator>=(const Fixed &other) const;
+ int operator<=(const Fixed &other) const;
+ int operator>(const Fixed &other) const;
+ int operator<(const Fixed &other) const;
+
+ Fixed operator+(const Fixed &other) const;
+ Fixed operator-(const Fixed &other) const;
+ Fixed operator*(const Fixed &other) const;
+ Fixed operator/(const Fixed &other) const;
+
+ Fixed operator++();
+ Fixed operator++(int);
+ Fixed operator--();
+ Fixed operator--(int);
+
+ static Fixed &min(Fixed &a, Fixed &b);
+ static const Fixed &min(const Fixed &a, const Fixed &b);
+ static Fixed &max(Fixed &a, Fixed &b);
+ static const Fixed &max(const Fixed &a, const Fixed &b);
+
+ int getRawBits() const;
+ void setRawBits(int const raw);
+ float toFloat() const;
+ int toInt() const;
+};
+
+std::ostream &operator<<(std::ostream &ostream, const Fixed &num);
+
+#endif // FIXED_H