jaulib v1.4.1
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
base_math.hpp File Reference
#include <climits>
#include <cmath>
#include <jau/int_math_ct.hpp>
#include <jau/int_types.hpp>
#include <jau/type_concepts.hpp>
Include dependency graph for base_math.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  jau
 __pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
 

Functions

template<jau::req::signed_arithmetic T>
constexpr T jau::abs (const T x) noexcept
 Returns the absolute value of an arithmetic number (w/ branching) in O(1)
 
template<jau::req::arithmetic T>
constexpr T jau::clamp (const T x, const T min_val, const T max_val) noexcept
 Returns constrained integral value to lie between given min- and maximum value (w/ branching) in O(1).
 
template<jau::req::arithmetic T>
bool jau::in_range (const T &a, const T &b, const T &range)
 base_math: arithmetic types, i.e.
 
template<jau::req::signed_arithmetic T>
constexpr T jau::invert_sign (const T x) noexcept
 Safely inverts the sign of an arithmetic number w/ branching in O(1)
 
template<jau::req::arithmetic T>
constexpr T jau::max (const T x, const T y) noexcept
 Returns the maximum of two integrals (w/ branching) in O(1)
 
template<jau::req::arithmetic T>
constexpr T jau::min (const T x, const T y) noexcept
 Returns the minimum of two integrals (w/ branching) in O(1)
 
template<jau::req::signed_arithmetic T>
constexpr int jau::sign (const T x) noexcept
 Returns the value of the sign function (w/o branching ?) in O(1).