mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-29 18:07:16 +02:00
@ -78,6 +78,7 @@ add_mp_units_module(
|
|||||||
include/mp-units/concepts.h
|
include/mp-units/concepts.h
|
||||||
include/mp-units/core.h
|
include/mp-units/core.h
|
||||||
include/mp-units/framework.h
|
include/mp-units/framework.h
|
||||||
|
include/mp-units/limits.h
|
||||||
MODULE_INTERFACE_UNIT mp-units-core.cpp
|
MODULE_INTERFACE_UNIT mp-units-core.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <mp-units/compat_macros.h>
|
#include <mp-units/compat_macros.h>
|
||||||
#include <mp-units/concepts.h>
|
#include <mp-units/concepts.h>
|
||||||
#include <mp-units/framework.h>
|
#include <mp-units/framework.h>
|
||||||
|
#include <mp-units/limits.h>
|
||||||
|
|
||||||
#if MP_UNITS_HOSTED
|
#if MP_UNITS_HOSTED
|
||||||
#include <mp-units/cartesian_vector.h>
|
#include <mp-units/cartesian_vector.h>
|
||||||
|
154
src/core/include/mp-units/limits.h
Normal file
154
src/core/include/mp-units/limits.h
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
// The MIT License (MIT)
|
||||||
|
//
|
||||||
|
// Copyright (c) 2018 Mateusz Pusz
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <mp-units/bits/module_macros.h>
|
||||||
|
#include <mp-units/framework/quantity.h>
|
||||||
|
#include <mp-units/framework/quantity_point.h>
|
||||||
|
|
||||||
|
#ifndef MP_UNITS_IN_MODULE_INTERFACE
|
||||||
|
#ifdef MP_UNITS_IMPORT_STD
|
||||||
|
import std;
|
||||||
|
#else
|
||||||
|
#include <limits>
|
||||||
|
#endif // MP_UNITS_IMPORT_STD
|
||||||
|
#endif // MP_UNITS_IN_MODULE_INTERFACE
|
||||||
|
|
||||||
|
template<auto R, typename Rep>
|
||||||
|
requires requires { typename std::numeric_limits<Rep>; }
|
||||||
|
class std::numeric_limits<mp_units::quantity<R, Rep>> : public std::numeric_limits<Rep> {
|
||||||
|
public:
|
||||||
|
static constexpr mp_units::quantity<R, Rep> min() noexcept
|
||||||
|
requires requires { mp_units::quantity<R, Rep>::min(); }
|
||||||
|
{
|
||||||
|
return mp_units::quantity<R, Rep>::min();
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity<R, Rep> max() noexcept
|
||||||
|
requires requires { mp_units::quantity<R, Rep>::max(); }
|
||||||
|
{
|
||||||
|
return mp_units::quantity<R, Rep>::max();
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity<R, Rep> lowest() noexcept
|
||||||
|
requires requires { std::numeric_limits<Rep>::lowest(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<Rep>::lowest(), R};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity<R, Rep> epsilon() noexcept
|
||||||
|
requires requires { std::numeric_limits<Rep>::epsilon(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<Rep>::epsilon(), R};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity<R, Rep> round_error() noexcept
|
||||||
|
requires requires { std::numeric_limits<Rep>::round_error(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<Rep>::round_error(), R};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity<R, Rep> infinity() noexcept
|
||||||
|
requires requires { std::numeric_limits<Rep>::infinity(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<Rep>::infinity(), R};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity<R, Rep> quiet_NaN() noexcept
|
||||||
|
requires requires { std::numeric_limits<Rep>::quiet_NaN(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<Rep>::quiet_NaN(), R};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity<R, Rep> signaling_NaN() noexcept
|
||||||
|
requires requires { std::numeric_limits<Rep>::signaling_NaN(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<Rep>::signaling_NaN(), R};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity<R, Rep> denorm_min() noexcept
|
||||||
|
requires requires { std::numeric_limits<Rep>::denorm_min(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<Rep>::denorm_min(), R};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<auto R, auto PO, typename Rep>
|
||||||
|
requires requires { typename std::numeric_limits<Rep>; }
|
||||||
|
class std::numeric_limits<mp_units::quantity_point<R, PO, Rep>> : public std::numeric_limits<Rep> {
|
||||||
|
public:
|
||||||
|
static constexpr mp_units::quantity_point<R, PO, Rep> min() noexcept
|
||||||
|
requires requires { mp_units::quantity_point<R, PO, Rep>::min(); }
|
||||||
|
{
|
||||||
|
return mp_units::quantity_point<R, PO, Rep>::min();
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity_point<R, PO, Rep> max() noexcept
|
||||||
|
requires requires { mp_units::quantity_point<R, PO, Rep>::max(); }
|
||||||
|
{
|
||||||
|
return mp_units::quantity_point<R, PO, Rep>::max();
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity_point<R, PO, Rep> lowest() noexcept
|
||||||
|
requires requires { std::numeric_limits<mp_units::quantity<R, Rep>>::lowest(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<mp_units::quantity<R, Rep>>::lowest(), PO};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity_point<R, PO, Rep> epsilon() noexcept
|
||||||
|
requires requires { std::numeric_limits<mp_units::quantity<R, Rep>>::epsilon(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<mp_units::quantity<R, Rep>>::epsilon(), PO};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity_point<R, PO, Rep> round_error() noexcept
|
||||||
|
requires requires { std::numeric_limits<mp_units::quantity<R, Rep>>::round_error(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<mp_units::quantity<R, Rep>>::round_error(), PO};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity_point<R, PO, Rep> infinity() noexcept
|
||||||
|
requires requires { std::numeric_limits<mp_units::quantity<R, Rep>>::infinity(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<mp_units::quantity<R, Rep>>::infinity(), PO};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity_point<R, PO, Rep> quiet_NaN() noexcept
|
||||||
|
requires requires { std::numeric_limits<mp_units::quantity<R, Rep>>::quiet_NaN(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<mp_units::quantity<R, Rep>>::quiet_NaN(), PO};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity_point<R, PO, Rep> signaling_NaN() noexcept
|
||||||
|
requires requires { std::numeric_limits<mp_units::quantity<R, Rep>>::signaling_NaN(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<mp_units::quantity<R, Rep>>::signaling_NaN(), PO};
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr mp_units::quantity_point<R, PO, Rep> denorm_min() noexcept
|
||||||
|
requires requires { std::numeric_limits<mp_units::quantity<R, Rep>>::denorm_min(); }
|
||||||
|
{
|
||||||
|
return {std::numeric_limits<mp_units::quantity<R, Rep>>::denorm_min(), PO};
|
||||||
|
}
|
||||||
|
};
|
@ -320,7 +320,8 @@ template<auto R1, typename Rep1, auto R2, typename Rep2>
|
|||||||
*/
|
*/
|
||||||
template<Representation Rep, Reference R>
|
template<Representation Rep, Reference R>
|
||||||
requires requires { std::numeric_limits<Rep>::epsilon(); }
|
requires requires { std::numeric_limits<Rep>::epsilon(); }
|
||||||
[[nodiscard]] constexpr quantity<R{}, Rep> epsilon(R r) noexcept
|
[[deprecated("Use `std::numeric_limits<Quantity>::epsilon()` instead")]] [[nodiscard]] constexpr quantity<R{}, Rep>
|
||||||
|
epsilon(R r) noexcept
|
||||||
{
|
{
|
||||||
return {static_cast<Rep>(std::numeric_limits<Rep>::epsilon()), r};
|
return {static_cast<Rep>(std::numeric_limits<Rep>::epsilon()), r};
|
||||||
}
|
}
|
||||||
|
@ -145,20 +145,6 @@ TEST_CASE("math operations", "[math]")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("numeric_limits functions")
|
|
||||||
{
|
|
||||||
SECTION("'epsilon' works as expected using default floating type")
|
|
||||||
{
|
|
||||||
REQUIRE(epsilon<double>(isq::length[m]).numerical_value_in(m) ==
|
|
||||||
std::numeric_limits<decltype(1. * isq::length[m])::rep>::epsilon());
|
|
||||||
}
|
|
||||||
SECTION("'epsilon' works as expected using integers")
|
|
||||||
{
|
|
||||||
REQUIRE(epsilon<int>(isq::length[m]).numerical_value_in(m) ==
|
|
||||||
std::numeric_limits<decltype(1 * isq::length[m])::rep>::epsilon());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("floor functions")
|
SECTION("floor functions")
|
||||||
{
|
{
|
||||||
SECTION("floor 1 second with target unit second should be 1 second")
|
SECTION("floor 1 second with target unit second should be 1 second")
|
||||||
|
@ -45,8 +45,9 @@ add_library(
|
|||||||
iec_test.cpp
|
iec_test.cpp
|
||||||
imperial_test.cpp
|
imperial_test.cpp
|
||||||
international_test.cpp
|
international_test.cpp
|
||||||
isq_test.cpp
|
|
||||||
isq_angle_test.cpp
|
isq_angle_test.cpp
|
||||||
|
isq_test.cpp
|
||||||
|
limits_test.cpp
|
||||||
natural_test.cpp
|
natural_test.cpp
|
||||||
prime_test.cpp
|
prime_test.cpp
|
||||||
quantity_point_test.cpp
|
quantity_point_test.cpp
|
||||||
|
188
test/static/limits_test.cpp
Normal file
188
test/static/limits_test.cpp
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
// The MIT License (MIT)
|
||||||
|
//
|
||||||
|
// Copyright (c) 2018 Mateusz Pusz
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
|
||||||
|
#include <mp-units/limits.h>
|
||||||
|
#include <mp-units/systems/si.h>
|
||||||
|
#ifdef MP_UNITS_IMPORT_STD
|
||||||
|
import std;
|
||||||
|
#else
|
||||||
|
#include <limits>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// ********************* QUANTITY *********************
|
||||||
|
|
||||||
|
using q_double = mp_units::quantity<mp_units::si::metre>;
|
||||||
|
using q_int = mp_units::quantity<mp_units::si::metre, int>;
|
||||||
|
|
||||||
|
// cv qualifiers
|
||||||
|
static_assert(std::numeric_limits<const q_double>::max() == q_double::max());
|
||||||
|
static_assert(std::numeric_limits<volatile q_double>::max() == q_double::max());
|
||||||
|
static_assert(std::numeric_limits<const volatile q_double>::max() == q_double::max());
|
||||||
|
|
||||||
|
// is_specialized
|
||||||
|
static_assert(std::numeric_limits<q_double>::is_specialized == true);
|
||||||
|
static_assert(std::numeric_limits<q_int>::is_specialized == true);
|
||||||
|
|
||||||
|
// is_integer
|
||||||
|
static_assert(std::numeric_limits<q_double>::is_integer == false);
|
||||||
|
static_assert(std::numeric_limits<q_int>::is_integer == true);
|
||||||
|
|
||||||
|
// has_infinity
|
||||||
|
static_assert(std::numeric_limits<q_double>::has_infinity == true);
|
||||||
|
static_assert(std::numeric_limits<q_int>::has_infinity == false);
|
||||||
|
|
||||||
|
// min
|
||||||
|
static_assert(std::numeric_limits<q_double>::min() == q_double::min());
|
||||||
|
static_assert(std::numeric_limits<q_int>::min() == q_int::min());
|
||||||
|
|
||||||
|
static_assert(std::numeric_limits<q_double>::min().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<double>::lowest());
|
||||||
|
static_assert(std::numeric_limits<q_int>::min().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::lowest());
|
||||||
|
|
||||||
|
// max
|
||||||
|
static_assert(std::numeric_limits<q_double>::max() == q_double::max());
|
||||||
|
static_assert(std::numeric_limits<q_int>::max() == q_int::max());
|
||||||
|
|
||||||
|
static_assert(std::numeric_limits<q_double>::max().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<double>::max());
|
||||||
|
static_assert(std::numeric_limits<q_int>::max().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::max());
|
||||||
|
|
||||||
|
// lowest
|
||||||
|
static_assert(std::numeric_limits<q_double>::lowest().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<double>::lowest());
|
||||||
|
static_assert(std::numeric_limits<q_int>::lowest().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::lowest());
|
||||||
|
|
||||||
|
// epsilon
|
||||||
|
static_assert(std::numeric_limits<q_double>::epsilon().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<double>::epsilon());
|
||||||
|
static_assert(std::numeric_limits<q_int>::epsilon().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::epsilon());
|
||||||
|
|
||||||
|
// round_error
|
||||||
|
static_assert(std::numeric_limits<q_double>::round_error().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<double>::round_error());
|
||||||
|
static_assert(std::numeric_limits<q_int>::round_error().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::round_error());
|
||||||
|
|
||||||
|
// infinity
|
||||||
|
static_assert(std::numeric_limits<q_double>::infinity().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<double>::infinity());
|
||||||
|
static_assert(std::numeric_limits<q_int>::infinity().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::infinity());
|
||||||
|
|
||||||
|
// quiet_NaN
|
||||||
|
static_assert(std::isnan(std::numeric_limits<q_double>::quiet_NaN().numerical_value_in(mp_units::si::metre)));
|
||||||
|
|
||||||
|
// signaling_NaN
|
||||||
|
static_assert(std::isnan(std::numeric_limits<q_double>::signaling_NaN().numerical_value_in(mp_units::si::metre)));
|
||||||
|
|
||||||
|
// denorm_min
|
||||||
|
static_assert(std::numeric_limits<q_double>::denorm_min().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<double>::denorm_min());
|
||||||
|
static_assert(std::numeric_limits<q_int>::denorm_min().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::denorm_min());
|
||||||
|
|
||||||
|
|
||||||
|
// ********************* QUANTITY POINT *********************
|
||||||
|
|
||||||
|
using qp_double = mp_units::quantity_point<mp_units::si::metre>;
|
||||||
|
using qp_int = mp_units::quantity_point<mp_units::si::metre, mp_units::default_point_origin(mp_units::si::metre), int>;
|
||||||
|
|
||||||
|
// cv qualifiers
|
||||||
|
static_assert(std::numeric_limits<const qp_double>::max() == qp_double::max());
|
||||||
|
static_assert(std::numeric_limits<volatile qp_double>::max() == qp_double::max());
|
||||||
|
static_assert(std::numeric_limits<const volatile qp_double>::max() == qp_double::max());
|
||||||
|
|
||||||
|
// is_specialized
|
||||||
|
static_assert(std::numeric_limits<qp_double>::is_specialized == true);
|
||||||
|
static_assert(std::numeric_limits<qp_int>::is_specialized == true);
|
||||||
|
|
||||||
|
// is_integer
|
||||||
|
static_assert(std::numeric_limits<qp_double>::is_integer == false);
|
||||||
|
static_assert(std::numeric_limits<qp_int>::is_integer == true);
|
||||||
|
|
||||||
|
// has_infinity
|
||||||
|
static_assert(std::numeric_limits<qp_double>::has_infinity == true);
|
||||||
|
static_assert(std::numeric_limits<qp_int>::has_infinity == false);
|
||||||
|
|
||||||
|
// min
|
||||||
|
static_assert(std::numeric_limits<qp_double>::min() == qp_double::min());
|
||||||
|
static_assert(std::numeric_limits<qp_int>::min() == qp_int::min());
|
||||||
|
|
||||||
|
static_assert(std::numeric_limits<qp_double>::min().quantity_from_zero().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<double>::lowest());
|
||||||
|
static_assert(std::numeric_limits<qp_int>::min().quantity_from_zero().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::lowest());
|
||||||
|
|
||||||
|
// max
|
||||||
|
static_assert(std::numeric_limits<qp_double>::max() == qp_double::max());
|
||||||
|
static_assert(std::numeric_limits<qp_int>::max() == qp_int::max());
|
||||||
|
|
||||||
|
static_assert(std::numeric_limits<qp_double>::max().quantity_from_zero().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<double>::max());
|
||||||
|
static_assert(std::numeric_limits<qp_int>::max().quantity_from_zero().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::max());
|
||||||
|
|
||||||
|
// lowest
|
||||||
|
static_assert(std::numeric_limits<qp_double>::lowest().quantity_from_zero().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<double>::lowest());
|
||||||
|
static_assert(std::numeric_limits<qp_int>::lowest().quantity_from_zero().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::lowest());
|
||||||
|
|
||||||
|
// epsilon
|
||||||
|
static_assert(std::numeric_limits<qp_double>::epsilon().quantity_from_zero().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<double>::epsilon());
|
||||||
|
static_assert(std::numeric_limits<qp_int>::epsilon().quantity_from_zero().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::epsilon());
|
||||||
|
|
||||||
|
// round_error
|
||||||
|
static_assert(std::numeric_limits<qp_double>::round_error().quantity_from_zero().numerical_value_in(
|
||||||
|
mp_units::si::metre) == std::numeric_limits<double>::round_error());
|
||||||
|
static_assert(std::numeric_limits<qp_int>::round_error().quantity_from_zero().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::round_error());
|
||||||
|
|
||||||
|
// infinity
|
||||||
|
static_assert(std::numeric_limits<qp_double>::infinity().quantity_from_zero().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<double>::infinity());
|
||||||
|
static_assert(std::numeric_limits<qp_int>::infinity().quantity_from_zero().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::infinity());
|
||||||
|
|
||||||
|
// quiet_NaN
|
||||||
|
static_assert(
|
||||||
|
std::isnan(std::numeric_limits<qp_double>::quiet_NaN().quantity_from_zero().numerical_value_in(mp_units::si::metre)));
|
||||||
|
|
||||||
|
// signaling_NaN
|
||||||
|
static_assert(std::isnan(
|
||||||
|
std::numeric_limits<qp_double>::signaling_NaN().quantity_from_zero().numerical_value_in(mp_units::si::metre)));
|
||||||
|
|
||||||
|
// denorm_min
|
||||||
|
static_assert(std::numeric_limits<qp_double>::denorm_min().quantity_from_zero().numerical_value_in(
|
||||||
|
mp_units::si::metre) == std::numeric_limits<double>::denorm_min());
|
||||||
|
static_assert(std::numeric_limits<qp_int>::denorm_min().quantity_from_zero().numerical_value_in(mp_units::si::metre) ==
|
||||||
|
std::numeric_limits<int>::denorm_min());
|
||||||
|
|
||||||
|
} // namespace
|
Reference in New Issue
Block a user