JPL Spatial
Sound spatialization and propagation library
Loading...
Searching...
No Matches
Math.h File Reference
#include "JPLSpatial/Core.h"
#include <numbers>
#include <cmath>
#include <limits>
#include <concepts>
#include <type_traits>
#include <bit>
#include <utility>

Go to the source code of this file.

Classes

struct  JPL::FloatNubmer< float >
 
struct  JPL::FloatNubmer< double >
 

Namespaces

namespace  JPL
 
namespace  JPL::Math
 
namespace  JPL::Math::Detail
 Square Root.
 

Concepts

concept  JPL::Math::CArithmetic
 
concept  JPL::Math::COrderedWith
 
concept  JPL::Math::CArithmeticAndOrderedWith
 

Functions

template<std::floating_point T>
JPL_INLINE constexprJPL::Math::ToRadians (T degrees) noexcept
 Function to convert degrees to radians.
 
template<std::floating_point T>
JPL_INLINE constexprJPL::Math::ToDegrees (T radians) noexcept
 Function to convert radians to degrees.
 
template<std::floating_point T>
JPL_INLINE constexpr bool JPL::Math::IsNan (T x) noexcept
 
template<CArithmetic T>
JPL_INLINE constexpr auto JPL::Math::Abs (const T &value) noexcept
 Standard abs is not constexpr in C++20.
 
template<std::floating_point T>
JPL_INLINE constexprJPL::Math::Floor (T value) noexcept
 A constexpr implementation of floor.
 
template<CArithmetic T>
JPL_INLINE constexprJPL::Math::Sign (T value) noexcept
 Sign returns -1 for negative values, 1 for positive, 0 for 0.
 
template<CArithmetic T>
JPL_INLINE constexprJPL::Math::Sign2 (T value) noexcept
 Sign2 returns -1 for negative values, 1 otherwise.
 
template<CArithmetic T1, CArithmeticAndOrderedWith< T1 > T2>
JPL_INLINE constexpr bool JPL::Math::IsPositiveAndBelow (T1 value, T2 below) noexcept
 
template<std::floating_point T>
JPL_INLINE constexpr bool JPL::Math::IsNearlyZero (T value, T errorTolerance=JPL_FLOAT_EPS_V< T >) noexcept
 
template<std::floating_point T>
JPL_INLINE constexpr bool JPL::Math::IsNearlyEqual (T a, T b, T tolerance=JPL_FLOAT_EPS_V< T >) noexcept
 
template<std::integral T>
JPL_INLINE constexpr bool JPL::Math::IsEven (T number) noexcept
 
template<std::floating_point T>
JPL_INLINE std::pair< T, T > JPL::Math::SinCos (T value) noexcept
 
template<std::floating_point T>
JPL_INLINE constexprJPL::Math::Lerp (const T &v0, const T &v1, T t) noexcept
 Linearly interpolate v0 towards v1.
 
template<std::integral T, std::floating_point Tt>
JPL_INLINE constexprJPL::Math::Lerp (const T &v0, const T &v1, Tt t) noexcept
 Linearly interpolate v0 towards v1.
 
template<std::floating_point T>
JPL_INLINE constexprJPL::Math::FMA (T a, T b, T c) noexcept
 Inlined fuse multiply-add. Compiler in some circumstances is more eager to optimize this than std::fma.
 
template<std::floating_point T>
constexprJPL::Math::Detail::QNan () noexcept
 constexpr-friendly quiet NaN (IEEE-754 only)
 
template<std::floating_point T>
constexprJPL::Math::Detail::InvSqrtInitialGuess (T x) noexcept
 
template<std::floating_point T, int NR>
constexprJPL::Math::Detail::InvSqrtNewtonRefine (T x, T y) noexcept
 Scalar NR on inverse sqrt.
 
template<std::floating_point T, int NR>
constexprJPL::Math::Detail::SqrtConstevalFallback (T x) noexcept
 Pure constexpr fallback sqrt using inverse-sqrt NR.
 
template<std::floating_point T, int NR = 2>
JPL_INLINE constexprJPL::Math::Sqrt (T x) noexcept
 
template<std::floating_point T, int NR = 2>
JPL_INLINE constexprJPL::Math::InvSqrt (T x) noexcept