-
Notifications
You must be signed in to change notification settings - Fork 915
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
Slightly improve accuracy of stod in to_floats #10622
Slightly improve accuracy of stod in to_floats #10622
Conversation
Codecov Report
@@ Coverage Diff @@
## branch-22.06 #10622 +/- ##
================================================
+ Coverage 86.30% 86.34% +0.03%
================================================
Files 140 140
Lines 22255 22280 +25
================================================
+ Hits 19207 19237 +30
+ Misses 3048 3043 -5
Continue to review full report at Codecov.
|
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.
Nice find, LGTM. I assume unifying the different methods in #10599 is pending a longer discussion, perhaps about porting to libcu++ eventually?
Yes. The current discussion is about having cuIO try to reuse this |
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.
LGTM 👍
@gpucibot merge |
Fixes a rounding error on extremely small floating-point numbers in the range `1E-287 - 1E-307`. These values were incorrectly being rounded to zero due to the fix in #10622. The extra float operation removed in #10622 is necessary for values in this range to keep them from being converted to zero. The fix adds a check so the extra floating point operation is only used when the overall exponent falls below `std::numeric_limits<double>::min_exponent10` (which is `-307`). The `ToFloat64` gtest was also updated to include value in this range to ensure this error does not occur again. Additionally, the conversion now supports subnormal numbers that are very very small in the range of E-307 and E-324. Authors: - David Wendt (https://github.com/davidwendt) Approvers: - Bradley Dice (https://github.com/bdice) - Yunsong Wang (https://github.com/PointKernel) - Mike Wilson (https://github.com/hyperbolic2346) URL: #10672
Reference #10599
Provides a slight improvement in accuracy for the internal stod device function used by the
cudf::strings::to_floats()
API.Reduces the number of floating-point operations by 1 and also applies the exponent by conditionally multiplying or dividing depending on it being positive or negative. This slightly improves accuracy of the result since multiplying decimal fractions in floating point can compound errors.
The 1.0 floating-point value in bits was
3FEFFFFFFFFFFFFF
and now computes to3FF0000000000000
which is 1.0.The 0.1 floating-point value in bits was
3FB9999999999999
and now computes to3FB999999999999A
which is now 0.10000000000000001 so the error is the same as 0.09999999999999999 but both are within expected epsilon.Since the overall error is within
std::numerics<T>::epsilon()
error threshold, no tests had to be modified.