mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 02:47:16 +02:00
Merge branch 'master' into bugfix/allow-lvalue-references-in-value-cast
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
#include <mp-units/bits/module_macros.h>
|
||||
#include <mp-units/framework/customization_points.h>
|
||||
#include <mp-units/framework/quantity.h>
|
||||
#include <mp-units/framework/quantity_point.h>
|
||||
#include <mp-units/framework/unit.h>
|
||||
#include <mp-units/framework/value_cast.h>
|
||||
|
||||
@ -130,10 +131,10 @@ template<auto R, typename Rep>
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Determines if a number is finite.
|
||||
* @brief Determines if a quantity is finite.
|
||||
*
|
||||
* @param a: Number to analyze.
|
||||
* @return bool: Whether the number is finite or not.
|
||||
* @param a: Quantity to analyze.
|
||||
* @return bool: Whether the quantity is finite or not.
|
||||
*/
|
||||
template<auto R, typename Rep>
|
||||
requires requires(Rep v) { isfinite(v); } || requires(Rep v) { std::isfinite(v); }
|
||||
@ -144,10 +145,23 @@ template<auto R, typename Rep>
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Determines if a number is infinite.
|
||||
* @brief Determines if a quantity point is finite.
|
||||
*
|
||||
* @param a: Number to analyze.
|
||||
* @return bool: Whether the number is infinite or not.
|
||||
* @param a: Quantity point to analyze.
|
||||
* @return bool: Whether the quantity point is finite or not.
|
||||
*/
|
||||
template<auto R, auto PO, typename Rep>
|
||||
requires requires(quantity<R, Rep> q) { isfinite(q); }
|
||||
[[nodiscard]] constexpr bool isfinite(const quantity_point<R, PO, Rep>& a) noexcept
|
||||
{
|
||||
return isfinite(a.quantity_ref_from(a.point_origin));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Determines if a quantity is infinite.
|
||||
*
|
||||
* @param a: Quantity to analyze.
|
||||
* @return bool: Whether the quantity is infinite or not.
|
||||
*/
|
||||
template<auto R, typename Rep>
|
||||
requires requires(Rep v) { isinf(v); } || requires(Rep v) { std::isinf(v); }
|
||||
@ -157,12 +171,25 @@ template<auto R, typename Rep>
|
||||
return isinf(a.numerical_value_ref_in(a.unit));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Determines if a quantity point is infinite.
|
||||
*
|
||||
* @param a: Quantity point to analyze.
|
||||
* @return bool: Whether the quantity point is infinite or not.
|
||||
*/
|
||||
template<auto R, auto PO, typename Rep>
|
||||
requires requires(quantity<R, Rep> q) { isinf(q); }
|
||||
[[nodiscard]] constexpr bool isinf(const quantity_point<R, PO, Rep>& a) noexcept
|
||||
{
|
||||
return isinf(a.quantity_ref_from(a.point_origin));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Determines if a number is a nan.
|
||||
* @brief Determines if a quantity is a nan.
|
||||
*
|
||||
* @param a: Number to analyze.
|
||||
* @return bool: Whether the number is a NaN or not.
|
||||
* @param a: Quantity to analyze.
|
||||
* @return bool: Whether the quantity is a NaN or not.
|
||||
*/
|
||||
template<auto R, typename Rep>
|
||||
requires requires(Rep v) { isnan(v); } || requires(Rep v) { std::isnan(v); }
|
||||
@ -172,6 +199,20 @@ template<auto R, typename Rep>
|
||||
return isnan(a.numerical_value_ref_in(a.unit));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Determines if a quantity point is a nan.
|
||||
*
|
||||
* @param a: Quantity point to analyze.
|
||||
* @return bool: Whether the quantity point is a NaN or not.
|
||||
*/
|
||||
template<auto R, auto PO, typename Rep>
|
||||
requires requires(quantity<R, Rep> q) { isnan(q); }
|
||||
[[nodiscard]] constexpr bool isnan(const quantity_point<R, PO, Rep>& a) noexcept
|
||||
{
|
||||
return isnan(a.quantity_ref_from(a.point_origin));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Computes the fma of 3 quantities
|
||||
*
|
||||
|
Reference in New Issue
Block a user