Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not a Number - values #282

Open
wouterz opened this issue Nov 15, 2021 · 3 comments
Open

Not a Number - values #282

wouterz opened this issue Nov 15, 2021 · 3 comments

Comments

@wouterz
Copy link

wouterz commented Nov 15, 2021

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.

@nholthaus
Copy link
Owner

nholthaus commented Nov 15, 2021 via email

@wouterz
Copy link
Author

wouterz commented Nov 16, 2021

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?

@nholthaus
Copy link
Owner

added NAN support in 3.0. Consider backporting to 2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants