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

Floating-Point Comparison Performance #775

Open
mborland opened this issue Mar 11, 2022 · 5 comments · May be fixed by #814
Open

Floating-Point Comparison Performance #775

mborland opened this issue Mar 11, 2022 · 5 comments · May be fixed by #814

Comments

@mborland
Copy link
Member

From this write up float distance could be several times better. I can poke around when implementing constexpr std::nexttoward as that is the last outlier in ccmath from this proposal.

@NAThompson
Copy link
Collaborator

Yeah, I think getting it to work quickly with multiprecision is the tricky part.

@jzmaddock
Copy link
Collaborator

Yeah, I think getting it to work quickly with multiprecision is the tricky part.

We would need the existing implementation for all non-builtin non-IEEE floats IMO.

But it's not just those, I suspect it's much harder than that blog post suggests once you handle all the corner cases correctly. I do remember that that code was a bitch to get correct.

We should have fairly good tests though, so if Matt wants to take a shot at the faster version by all means go for it :)

@NAThompson
Copy link
Collaborator

Oh don't forget the has_denorm! The trick doesn't work if the floating point unit doesn't support denorms.

@jzmaddock
Copy link
Collaborator

Oh don't forget the has_denorm! The trick doesn't work if the floating point unit doesn't support denorms.

It's worse, behaviour can vary at runtime: https://www.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/floating-point-operations/understanding-floating-point-operations/setting-the-ftz-and-daz-flags.html

@NAThompson
Copy link
Collaborator

eww; wouldn't that require query of the cpuid instruction on every call?

@mborland mborland linked a pull request Aug 5, 2022 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants