8 #ifndef META_OCEAN_MATH_APPROXIMATION_H
9 #define META_OCEAN_MATH_APPROXIMATION_H
30 static uint8_t
sqrt(
const uint8_t value);
38 static uint8_t
sqrt(
const uint16_t value);
48 static uint16_t
sqrt(
const uint32_t value);
58 static T
atan2(
const T y,
const T x);
78 template <
typename T,
bool tHigherAccuracy>
79 static inline T exp(T x);
102 template <
typename T,
bool tHigherAccuracy>
107 if constexpr (tHigherAccuracy)
109 x = T(1) + x * T(0.000244140625);
130 x = T(1) + x * T(0.00390625);
This class implements several numeric function with approximated results but with fast performances.
Definition: Approximation.h:21
static const uint16_t * sqrtLookup17()
Creates a lookup table for the sqrt function with range [0, 131,071].
static T atan2(const T y, const T x)
Returns the approximated arc tangent with an error below one degree.
static uint16_t sqrt(const uint32_t value)
Returns the square root for values inside range [0, 2^17).
static uint8_t sqrt(const uint8_t value)
Returns the square root for values inside range [0, 2^8).
static const uint8_t * sqrtLookup8()
Creates a lookup table for the sqrt function with range [0, 255].
static uint8_t sqrt(const uint16_t value)
Returns the square root for values inside range [0, 2^16).
static const uint8_t * sqrtLookup16()
Creates a lookup table for the sqrt function with range [0, 65,535].
static T exp(T x)
Returns the approximated exponential function exp(x) = e^x.
Definition: Approximation.h:103
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15