-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
f32/f64 MIN_EXP is either wrong or badly documented. #43583
Comments
I chased the |
MIN_EXP is "One greater than the minimum possible normal power of 2 exponent". For f64, the smallest normal number is 2-1022, so MIN_EXP = -1022 + 1 = -1021 as expected. I don't know why such a strange definition is picked, but this follows how ***_MIN_EXP is defined in C and C++.
|
@kennytm That doesn't add up. |
Uhh, the smallest normal f64 is indeed 2-1022, not 2-1023. The latter is a subnormal with a significand of |
Oh, figured it out. |
They are both
-MAX_EXP + 3
whilecore::num::dec2flt::RawFloat
uses-MAX_EXP + 1
.Also, APFloat (being ported to Rust in #43554) uses the same
-MAX_EXP + 1
value.That is the value of the exponent for the smallest normal, AFAIK.
cc @rust-lang/libs @est31 @nagisa @lifthrasiir @rkruppe
The text was updated successfully, but these errors were encountered: