You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.3 KiB

3 years ago
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Fixed.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/20 10:06:37 by narnaud #+# #+# */
/* Updated: 2022/06/20 14:49:38 by narnaud ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include <iostream>
#include <cmath>
class Fixed {
public:
Fixed (void);
Fixed (const int init_int);
Fixed (const float init_float);
Fixed (Fixed const & src);
~Fixed (void);
Fixed & operator= (Fixed const & src);
int getRawBits(void) const;
void setRawBits(int const raw);
float toFloat(void) const;
int toInt(void) const;
private:
int _raw_bits;
static const int _fract_bits;
};
std::ostream & operator << (std::ostream &out, const Fixed &f);