diff --git a/README.md b/README.md index 2b7fa5a..6bd7672 100644 --- a/README.md +++ b/README.md @@ -947,9 +947,6 @@ T fract(T x) noexcept; template < floating_point T > T fmod(T x, T y) noexcept; -template < floating_point T > -T modf(T x, T* y) noexcept; - template < floating_point T > T copysign(T x, T s) noexcept; @@ -977,23 +974,8 @@ constexpr T step(T edge, T x) noexcept; template < floating_point T > constexpr T smoothstep(T edge0, T edge1, T x) noexcept; -template < arithmetic T > -bool isnan(T x) noexcept; - -template < arithmetic T > -bool isinf(T x) noexcept; - -template < arithmetic T > -bool isfinite(T x) noexcept; - template < floating_point T > T fma(T x, T y, T z) noexcept; - -template < floating_point T > -T frexp(T x, int* exp) noexcept; - -template < floating_point T > -T ldexp(T x, int exp) noexcept; ``` #### Vector @@ -1032,9 +1014,6 @@ vec fmod(const vec& xs, T y); template < typename T, size_t Size > vec fmod(const vec& xs, const vec& ys); -template < typename T, size_t Size > -vec modf(const vec& xs, vec* is); - template < typename T, size_t Size > vec copysign(const vec& xs, T s); @@ -1098,23 +1077,8 @@ constexpr vec smoothstep(T edge0, T edge1, const vec& xs); template < typename T, size_t Size > constexpr vec smoothstep(const vec& edges0, const vec& edges1, const vec& xs); -template < typename T, size_t Size > -vec isnan(const vec& xs); - -template < typename T, size_t Size > -vec isinf(const vec& xs); - -template < typename T, size_t Size > -vec isfinite(const vec& xs); - template < typename T, size_t Size > vec fma(const vec& as, const vec& bs, const vec& cs); - -template < typename T, size_t Size > -vec frexp(const vec& xs, vec* exps); - -template < typename T, size_t Size > -vec ldexp(const vec& xs, const vec& exps); ``` #### Quaternion @@ -1131,15 +1095,6 @@ qua nlerp(const qua& unit_xs, const qua& unit_ys, T a); template < typename T > qua slerp(const qua& unit_xs, const qua& unit_ys, T a); - -template < typename T > -vec isnan(const qua& xs); - -template < typename T > -vec isinf(const qua& xs); - -template < typename T > -vec isfinite(const qua& xs); ``` ### Angle and Trigonometric Functions diff --git a/headers/vmath.hpp/vmath_fun.hpp b/headers/vmath.hpp/vmath_fun.hpp index ad675d2..0e43580 100644 --- a/headers/vmath.hpp/vmath_fun.hpp +++ b/headers/vmath.hpp/vmath_fun.hpp @@ -80,12 +80,6 @@ namespace vmath_hpp return std::fmod(x, y); } - template < typename T > - [[nodiscard]] std::enable_if_t, T> - modf(T x, T* y) noexcept { - return std::modf(x, y); - } - template < typename T > [[nodiscard]] std::enable_if_t, T> copysign(T x, T s) noexcept { @@ -141,41 +135,11 @@ namespace vmath_hpp return t * t * (T(3) - T(2) * t); } - template < typename T > - [[nodiscard]] std::enable_if_t, bool> - isnan(T x) noexcept { - return std::isnan(x); - } - - template < typename T > - [[nodiscard]] std::enable_if_t, bool> - isinf(T x) noexcept { - return std::isinf(x); - } - - template < typename T > - [[nodiscard]] std::enable_if_t, bool> - isfinite(T x) noexcept { - return std::isfinite(x); - } - template < typename T > [[nodiscard]] std::enable_if_t, T> fma(T x, T y, T z) noexcept { return std::fma(x, y, z); } - - template < typename T > - [[nodiscard]] std::enable_if_t, T> - frexp(T x, int* exp) noexcept { - return std::frexp(x, exp); - } - - template < typename T > - [[nodiscard]] std::enable_if_t, T> - ldexp(T x, int exp) noexcept { - return std::ldexp(x, exp); - } } // diff --git a/headers/vmath.hpp/vmath_qua_fun.hpp b/headers/vmath.hpp/vmath_qua_fun.hpp index b9bde5f..59d1624 100644 --- a/headers/vmath.hpp/vmath_qua_fun.hpp +++ b/headers/vmath.hpp/vmath_qua_fun.hpp @@ -196,21 +196,6 @@ namespace vmath_hpp return normalize(lerp(unit_xs, unit_ys, xs_scale, ys_scale)); } } - - template < typename T > - [[nodiscard]] vec isnan(const qua& xs) { - return isnan(vec{xs}); - } - - template < typename T > - [[nodiscard]] vec isinf(const qua& xs) { - return isinf(vec{xs}); - } - - template < typename T > - [[nodiscard]] vec isfinite(const qua& xs) { - return isfinite(vec{xs}); - } } // diff --git a/headers/vmath.hpp/vmath_vec_fun.hpp b/headers/vmath.hpp/vmath_vec_fun.hpp index a91ce26..0218a43 100644 --- a/headers/vmath.hpp/vmath_vec_fun.hpp +++ b/headers/vmath.hpp/vmath_vec_fun.hpp @@ -556,20 +556,6 @@ namespace vmath_hpp return map_join([](T x, T y) { return fmod(x, y); }, xs, ys); } - namespace impl - { - template < typename T, std::size_t Size, std::size_t... Is > - VMATH_HPP_FORCE_INLINE - vec modf_impl(const vec& xs, vec* is, std::index_sequence) { - return { modf(xs[Is], &(*is)[Is])... }; - } - } - - template < typename T, std::size_t Size > - vec modf(const vec& xs, vec* is) { - return impl::modf_impl(xs, is, std::make_index_sequence{}); - } - template < typename T, std::size_t Size > [[nodiscard]] vec copysign(const vec& xs, T s) { return map_join([s](T x) { return copysign(x, s); }, xs); @@ -684,44 +670,10 @@ namespace vmath_hpp return map_join([](T edge0, T edge1, T x) { return smoothstep(edge0, edge1, x); }, edges0, edges1, xs); } - template < typename T, std::size_t Size > - [[nodiscard]] vec isnan(const vec& xs) { - return map_join([](T x) { return isnan(x); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] vec isinf(const vec& xs) { - return map_join([](T x) { return isinf(x); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] vec isfinite(const vec& xs) { - return map_join([](T x) { return isfinite(x); }, xs); - } - template < typename T, std::size_t Size > [[nodiscard]] vec fma(const vec& as, const vec& bs, const vec& cs) { return map_join([](T a, T b, T c) { return fma(a, b, c); }, as, bs, cs); } - - namespace impl - { - template < typename T, std::size_t Size, std::size_t... Is > - VMATH_HPP_FORCE_INLINE - vec frexp_impl(const vec& xs, vec* exps, std::index_sequence) { - return { frexp(xs[Is], &(*exps)[Is])... }; - } - } - - template < typename T, std::size_t Size > - vec frexp(const vec& xs, vec* exps) { - return impl::frexp_impl(xs, exps, std::make_index_sequence{}); - } - - template < typename T, std::size_t Size > - [[nodiscard]] vec ldexp(const vec& xs, const vec& exps) { - return map_join([](T x, int exp) { return ldexp(x, exp); }, xs, exps); - } } // diff --git a/untests/vmath_fun_tests.cpp b/untests/vmath_fun_tests.cpp index 7096730..b105a74 100644 --- a/untests/vmath_fun_tests.cpp +++ b/untests/vmath_fun_tests.cpp @@ -77,12 +77,6 @@ TEST_CASE("vmath/fun") { CHECK(fmod(1.7f, 1.2f) == uapprox(0.5f)); - { - float out_i{}; - CHECK(modf(1.7f, &out_i) == uapprox(0.7f)); - CHECK(out_i == uapprox(1.f)); - } - STATIC_CHECK(min(0.f, 1.f) == uapprox(0.f)); STATIC_CHECK(max(0.f, 1.f) == uapprox(1.f)); @@ -106,19 +100,7 @@ TEST_CASE("vmath/fun") { STATIC_CHECK(step(0.5f, 0.6f) == uapprox(1.f)); STATIC_CHECK(smoothstep(0.f, 1.f, 0.1f) == uapprox(0.028f)); - CHECK_FALSE(vmath_hpp::isnan(1.f)); - CHECK_FALSE(vmath_hpp::isinf(1.f)); - CHECK(vmath_hpp::isfinite(1.f)); - CHECK(fma(2.f, 3.f, 4.f) == uapprox(10.f)); - - { - int out_exp{}; - CHECK(frexp(1.7f, &out_exp) == uapprox(0.85f)); - CHECK(out_exp == 1); - } - - CHECK(ldexp(0.85f, 1) == uapprox(1.7f)); } SUBCASE("Geometric Functions") { diff --git a/untests/vmath_qua_fun_tests.cpp b/untests/vmath_qua_fun_tests.cpp index f56a5e2..9b6df77 100644 --- a/untests/vmath_qua_fun_tests.cpp +++ b/untests/vmath_qua_fun_tests.cpp @@ -128,12 +128,6 @@ TEST_CASE("vmath/qua_fun") { qrotate_z(radians(290.f)), slerp(qrotate_z(radians(220.f)), qrotate_z(radians(0.f)), 0.5f)))); } - - { - CHECK_FALSE(any(isnan(qfloat(1,1,1,1)))); - CHECK_FALSE(any(isinf(qfloat(1,1,1,1)))); - CHECK(all(isfinite(qfloat(1,1,1,1)))); - } } SUBCASE("Geometric Functions") { diff --git a/untests/vmath_tests.hpp b/untests/vmath_tests.hpp index d6be42e..7b56cf7 100644 --- a/untests/vmath_tests.hpp +++ b/untests/vmath_tests.hpp @@ -57,7 +57,7 @@ namespace vmath_tests template < typename T > constexpr bool operator==(const vec& l, const uapprox2& r) { - return all(approx(l, r.value,r.epsilon)); + return all(approx(l, r.value, r.epsilon)); } template < typename T > diff --git a/untests/vmath_vec_fun_tests.cpp b/untests/vmath_vec_fun_tests.cpp index f5d54c3..873c26f 100644 --- a/untests/vmath_vec_fun_tests.cpp +++ b/untests/vmath_vec_fun_tests.cpp @@ -201,12 +201,6 @@ TEST_CASE("vmath/vec_fun") { CHECK(fmod(float2(1.7f), 1.2f) == uapprox2(0.5f)); CHECK(fmod(float2(1.7f), float2(1.2f)) == uapprox2(0.5f)); - { - float2 out_i{}; - CHECK(modf(float2(1.7f), &out_i) == uapprox2(0.7f)); - CHECK(out_i.x == uapprox(1.f)); - } - STATIC_CHECK(min(int2(1,2)) == 1); STATIC_CHECK(min(int2(1,2), 1) == int2(1,1)); STATIC_CHECK(min(1, int2(1,2)) == int2(1,1)); @@ -246,19 +240,7 @@ TEST_CASE("vmath/vec_fun") { STATIC_CHECK(smoothstep(0.f, 1.f, float2(0.1f)) == uapprox2(0.028f)); STATIC_CHECK(smoothstep(float2(0.f), float2(1.f), float2(0.1f)) == uapprox2(0.028f)); - CHECK_FALSE(isnan(float2(1.f)).x); - CHECK_FALSE(isinf(float2(1.f)).x); - CHECK(isfinite(float2(1.f)).x); - CHECK_FALSE(fma(float2(2.f), float2(3.f), float2(4.f)).x == uapprox(12.f)); - - { - int2 out_exp{}; - CHECK(frexp(float2(1.7f), &out_exp).x == uapprox(0.85f)); - CHECK(out_exp == int2(1)); - } - - CHECK(ldexp(float2(0.85f), int2(1)).x == uapprox(1.7f)); } SUBCASE("Geometric Functions") {