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

Fixes for double precision erfc. #553

Merged
merged 1 commit into from
Oct 7, 2024
Merged

Conversation

hvdijk
Copy link
Collaborator

@hvdijk hvdijk commented Oct 7, 2024

Overview

Fixes for double precision erfc.

Reason for change

Describe how the current behaviour of the project is causing problems for you
or is otherwise unsatisfactory for your use case.

Description of change

  • polynomial5 did not provide as many coefficients as needed for sufficiently accurate results around x=7. Use sollya to recompute.
  • s6, s7, s8 multiplied by x rather than by xAbs, leading to incorrect results for x<0.
  • s6, s7, s8 lost precision in the multiplication by x. Use multiply_exact_unsafe instead, and then transform exp(mul_hi + mul_lo) into exp(mul_hi) * exp(mul_lo).
  • The transformation of erfc(-x) = 2 - erfc(x) checked the sign bit of the intermediate result, rather than the sign bit of x, again leading to incorrect results for x<0.
  • The cut-off point for returning 0 was set as x > 27.0, but this is not right, the cut-off point should be slightly higher.

Anything else we should know?

These errors were caught by a new test in OpenCL CTS.

Checklist

  • Read and follow the project Code of Conduct.
  • Make sure the project builds successfully with your changes.
  • Run relevant testing locally to avoid regressions.
  • Run clang-format-17 on all modified code.

- polynomial5 did not provide as many coefficients as needed for
  sufficiently accurate results around x=7. Use sollya to recompute.
- s6, s7, s8 multiplied by x rather than by xAbs, leading to incorrect
  results for x<0.
- s6, s7, s8 lost precision in the multiplication by x. Use
  multiply_exact_unsafe instead, and then transform exp(mul_hi + mul_lo)
  into exp(mul_hi) * exp(mul_lo).
- The transformation of erfc(-x) = 2 - erfc(x) checked the sign bit of
  the intermediate result, rather than the sign bit of x, again leading
  to incorrect results for x<0.
- The cut-off point for returning 0 was set as x > 27.0, but this is not
  right, the cut-off point should be slightly higher.

These errors were caught by a new test in OpenCL CTS.
@hvdijk hvdijk merged commit c46f28e into uxlfoundation:main Oct 7, 2024
6 checks passed
@hvdijk hvdijk deleted the fix-erfc branch October 7, 2024 13:52
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 this pull request may close these issues.

2 participants