CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
FixedPoint.hpp File Reference
#include "CeresEngine/DataTypes.hpp"
#include "CeresEngine/Foundation/Hash.hpp"
#include "CeresEngine/Foundation/Container/Array.hpp"
#include "CeresEngine/Math/Math.hpp"
#include <cmath>
#include <limits>

Go to the source code of this file.

Classes

struct  Math::FixedPoint< T, P >
 

Namespaces

namespace  Math
 

Typedefs

using Math::Fixed32x32 = FixedPoint< Int64, 32 >
 A general purpose 32.32 fixed point type.
 
using Math::Fixed44x20 = FixedPoint< Int64, 20 >
 A general purpose 44.20 fixed point type.
 
using Math::Fixed20x44 = FixedPoint< Int64, 44 >
 A general purpose 20.44 fixed point type.
 
using Math::Fixed48x16 = Math::FixedPoint< Int64, 16 >
 A general purpose 48.16 fixed point type.
 
using Math::Fixed16x48 = Math::FixedPoint< Int64, 48 >
 A general purpose 16.48 fixed point type.
 

Functions

template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::operator- (const FixedPoint< T, P > a) noexcept
 Converts the fixed-point number a to it's negative representation.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::operator+ (const FixedPoint< T, P > a) noexcept
 Converts the fixed-point number a to it's negative representation.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::operator+ (const FixedPoint< T, P > a, const typename FixedPoint< T, P >::Self b) noexcept
 Add two fixed-point numbers a and b.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::operator- (const FixedPoint< T, P > a, const typename FixedPoint< T, P >::Self b) noexcept
 Subtract two fixed-point numbers a and b.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::operator* (const FixedPoint< T, P > x, const typename FixedPoint< T, P >::Self y) noexcept
 Multiply two fixed-point numbers a and b.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::operator/ (const FixedPoint< T, P > x, const typename FixedPoint< T, P >::Self y) noexcept
 Divide two fixed-point numbers a and b.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > & Math::operator+= (FixedPoint< T, P > &a, const typename FixedPoint< T, P >::Self b) noexcept
 Add two fixed-point numbers a and b and assigns the resulting value into a.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > & Math::operator++ (FixedPoint< T, P > &a) noexcept
 Increment the fixed-point value by adding 1.0 to it.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::operator++ (FixedPoint< T, P > &a, int) noexcept
 Increment the fixed-point value by adding 1.0 to it.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > & Math::operator-= (FixedPoint< T, P > &a, const typename FixedPoint< T, P >::Self b) noexcept
 Subtract two fixed-point numbers a and b and assigns the resulting value into a.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > & Math::operator-- (FixedPoint< T, P > &a) noexcept
 Decrement the fixed-point value by subtracting 1.0 from it.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::operator-- (FixedPoint< T, P > &a, int) noexcept
 Decrement the fixed-point value by subtracting 1.0 from it.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > & Math::operator*= (FixedPoint< T, P > &a, const typename FixedPoint< T, P >::Self b) noexcept
 Multiply two fixed-point numbers a and b and assigns the resulting value into a.
 
template<typename T , unsigned int P>
constexpr bool Math::operator== (const FixedPoint< T, P > a, const typename FixedPoint< T, P >::Self b) noexcept
 Compares two fixed-pointer numbers for equality.
 
template<typename T , unsigned int P>
constexpr bool Math::operator!= (const FixedPoint< T, P > a, const typename FixedPoint< T, P >::Self b) noexcept
 Compares two fixed-pointer numbers for inequality.
 
template<typename T , unsigned int P>
constexpr bool Math::operator< (const FixedPoint< T, P > a, const typename FixedPoint< T, P >::Self b) noexcept
 Compares two fixed-pointer numbers.
 
template<typename T , unsigned int P>
constexpr bool Math::operator< (const FixedPoint< T, P > a, double b) noexcept
 Compares two fixed-pointer numbers.
 
template<typename T , unsigned int P>
constexpr bool Math::operator<= (const FixedPoint< T, P > a, const typename FixedPoint< T, P >::Self b) noexcept
 Compares two fixed-pointer numbers.
 
template<typename T , unsigned int P>
constexpr bool Math::operator<= (const FixedPoint< T, P > a, double b) noexcept
 Compares two fixed-pointer numbers.
 
template<typename T , unsigned int P>
constexpr bool Math::operator> (const FixedPoint< T, P > a, const typename FixedPoint< T, P >::Self b) noexcept
 Compares two fixed-pointer numbers.
 
template<typename T , unsigned int P>
constexpr bool Math::operator> (const FixedPoint< T, P > a, double b) noexcept
 Compares two fixed-pointer numbers.
 
template<typename T , unsigned int P>
constexpr bool Math::operator>= (const FixedPoint< T, P > a, const typename FixedPoint< T, P >::Self b) noexcept
 Compares two fixed-pointer numbers.
 
template<typename T , unsigned int P>
constexpr bool Math::operator>= (const FixedPoint< T, P > a, double b) noexcept
 Compares two fixed-pointer numbers.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::abs (const FixedPoint< T, P > &x)
 Returns the absolute value of a fixed-point value.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::frac (const FixedPoint< T, P > &x)
 Returns the fractional portion of a fixed-point value.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::sign (const FixedPoint< T, P > &x)
 Returns sign of scalar a fixed-point value.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::floor (const FixedPoint< T, P > &x)
 Returns largest integer not greater than a fixed-point value.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::ceil (const FixedPoint< T, P > &x)
 Returns smallest integer not less than a fixed-point value.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::round (const FixedPoint< T, P > &x)
 Returns the rounded value a fixed-point value.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::sqrt (const FixedPoint< T, P > &x)
 Returns square root of a fixed-point value.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::acos (FixedPoint< T, P > x)
 Returns arccosine of a fixed-point value.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::asin (FixedPoint< T, P > x)
 Returns arcsine of a fixed-point value.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::atan2 (const FixedPoint< T, P > &y, const FixedPoint< T, P > &x)
 Returns arctangent of a fixed-point value.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::atan (const FixedPoint< T, P > &x)
 Returns arctangent of a fixed-point value.
 
template<typename B , unsigned int F>
constexpr FixedPoint< B, F > Math::fmod (FixedPoint< B, F > x, FixedPoint< B, F > y) noexcept
 
template<typename B , unsigned int F>
FixedPoint< B, F > Math::sin (FixedPoint< B, F > x) noexcept
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::cos (const FixedPoint< T, P > &x)
 Returns cosine of a fixed-point value.
 
template<typename T , unsigned int P>
constexpr FixedPoint< T, P > Math::tan (const FixedPoint< T, P > &x)
 Returns tangent of a fixed-point value. Returns the tangent of a in radians.
 
constexpr FixedPoint< Int64, sizeof(Int64) *8 - std::numeric_limits< double >::digits > Math::operator""_fp (const long double v)
 Creates a new fixed-point number from an literal floating-point value.