Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

72 строки
1.5 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://sam.zoy.org/projects/COPYING.WTFPL for more details.
  9. //
  10. //
  11. // The Real class
  12. // --------------
  13. //
  14. #if !defined __LOL_REAL_H__
  15. #define __LOL_REAL_H__
  16. #include <stdint.h>
  17. namespace lol
  18. {
  19. class real
  20. {
  21. static int const BIGITS = 32;
  22. public:
  23. inline real() { }
  24. real(float f);
  25. real(double f);
  26. real(int i);
  27. real(unsigned int i);
  28. operator float() const;
  29. operator double() const;
  30. operator int() const;
  31. operator unsigned int() const;
  32. real operator -() const;
  33. real operator +(real const &x) const;
  34. real operator -(real const &x) const;
  35. real operator *(real const &x) const;
  36. real operator /(real const &x) const;
  37. real &operator +=(real const &x);
  38. real &operator -=(real const &x);
  39. real &operator *=(real const &x);
  40. real &operator /=(real const &x);
  41. bool operator ==(real const &x) const;
  42. bool operator !=(real const &x) const;
  43. bool operator <(real const &x) const;
  44. bool operator >(real const &x) const;
  45. bool operator <=(real const &x) const;
  46. bool operator >=(real const &x) const;
  47. friend real fres(real const &x);
  48. void print() const;
  49. private:
  50. uint32_t m_size;
  51. uint32_t m_signexp;
  52. uint16_t m_mantissa[BIGITS];
  53. };
  54. } /* namespace lol */
  55. #endif // __LOL_REAL_H__