49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* Fixed.hpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: lfirmin <lfirmin@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/07/02 12:25:41 by lfirmin #+# #+# */
|
|
/* Updated: 2025/07/16 14:41:02 by lfirmin ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef FIXED_HPP
|
|
# define FIXED_HPP
|
|
|
|
#include <iostream>
|
|
#include <cmath>
|
|
|
|
|
|
class Fixed
|
|
{
|
|
private:
|
|
int _fixed_p_n;
|
|
static const int _number_fractional_bits;
|
|
|
|
public:
|
|
//const/dest
|
|
Fixed();
|
|
Fixed(const int input);
|
|
Fixed(const float input);
|
|
Fixed(const Fixed ©);
|
|
~Fixed();
|
|
|
|
//ol op
|
|
Fixed &operator=(const Fixed ©);
|
|
|
|
//pub method
|
|
float toFloat(void)const;
|
|
int toInt(void)const;
|
|
|
|
//get/set
|
|
int getRawBits(void) const;
|
|
void setRawBits(int const raw);
|
|
};
|
|
|
|
std::ostream &operator<<(std::ostream &o, Fixed const &fixed);
|
|
|
|
#endif
|