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

Correct for the odd offsetting that math/bigfloat does for exponents #1

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

pavpanchekha
Copy link
Contributor

This PR fixes failures in FPBench. Basically, in Racket's math/bigfloat package, the "exponent" of a bigfloat isn't what we normally think of as the exponent; it's more the exponent of 1 ULP. We gotta correct for that by adding (bigfloat-precision x).

@bksaiki
Copy link
Collaborator

bksaiki commented Dec 5, 2024

Good find. The fix may be better written as:

(define e (sub1 (+ exp (bigfloat-precision x))))
(define emin (mpfr-get-emin))
(cond
   [(< e emin) ; subnormal
...

But I think this works.

@bksaiki bksaiki merged commit 8f67534 into herbie-fp:master Dec 5, 2024
@pavpanchekha
Copy link
Contributor Author

Ah, sorry, I was going to pretty up the code after this meeting. Whatever.

@pavpanchekha pavpanchekha deleted the fix-ordinal branch December 5, 2024 22:13
This was referenced Dec 6, 2024
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