-
Notifications
You must be signed in to change notification settings - Fork 225
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
Faster floating point comparisons #814
base: develop
Are you sure you want to change the base?
Conversation
6c3977f
to
d5baadc
Compare
@NAThompson Since you got this to work previously for 128 bit float do you see anything obvious I am missing? Error for incomplete type here. |
IIRC, this was something I looked up in the quadmath manual. I couldn't find it though . . . |
2c2b13a
to
86b0dbd
Compare
@NAThompson This is good for review. I pulled 128 bit support into it's own header otherwise you would have to link quadmath anytime you used |
Any updates on this? |
Here are the before and after benchmarks @NAThompson :
|
|
||
BOOST_MATH_ASSERT(fast_float_distance(float_advance(val, 4), val) == -4); | ||
BOOST_MATH_ASSERT(fast_float_distance(float_advance(val, -4), val) == 4); | ||
if(std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::has_denorm == std::denorm_present)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't the fast float distance unconditionally require denorm support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just type punning so as long as the floating point and fixed width integer are the same number of bits you should be fine. I don't know of a platform without denorm support to test on.
@mborland : Does it need a @jzmaddock : This is looking like it's about ready to go; might want to take a look. |
The float and double cases improve upon the current implementation. I could not get the |
Wait, I thought we had to link |
Co-authored-by: Alexander Grund <Flamefire@users.noreply.github.com>
Could we use a judicious Also, 99% of the value will be from |
Having the include isn't enough in this case. You have to explicitly link to -lquadmath. |
@jzmaddock Can you please take a look at this one? @NAThompson hit me up about merging this. |
No description provided.