units
units copied to clipboard
Not a Number - values
Is a pull request extending the library with better NaN (numeric_limts::quiet/signaling)_NaN / :::infinity ) support considered, or are they omitted with reason? Additionally, if possible an extension of std::isnan might also be desirable.
They're not omitted for any reason. I'd certainly consider such a PR.
On Mon, Nov 15, 2021, 5:00 AM Wouter @.***> wrote:
Is a pull request extending the library with better NaN (numeric_limts::quiet/signaling)_NaN / :::infinity ) support considered, or are they omitted with reason? Additionally, an extension of std::isnan might be desirable.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nholthaus/units/issues/282, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOYOH6DM24IYSRVLZYBNQTUMDK2XANCNFSM5IBILRQA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Adding the numeric_limit functions it quite easy, spent quite some time trying to extend std::isnan, but im quite new to SFINAE / meta.
I feel like it should be something like:
template<typename UnitType, typename = std::enable_if_t<units::traits::is_unit_t<UnitType>::value && std::is_floating_point_v<UnitType::underlying_type>::value> >
inline bool isnan(const UnitType& x)
{
return std::isnan(x.value());
}
any ideas?
added NAN support in 3.0. Consider backporting to 2.3