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
Add constants for f16 and f128 #123850
base: master
Are you sure you want to change the base?
Add constants for f16 and f128 #123850
Conversation
cc @tgross35 |
This comment has been minimized.
This comment has been minimized.
9810c6e
to
e972a7f
Compare
This comment has been minimized.
This comment has been minimized.
Note that for constants gated under |
The test failure seems to be a panic in beta clippy.
|
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.
Hey, thank you for the help here!
I was holding off on these until we had the ability to actually run code that involves these types, which unfortunately we won't until I get compiler_builtins
updated (well, code will run on x86 but nothing else so we can't actually merge anything). I was trying to add as little as possible until we get tests, but don't have any big problem with adding these.
One change needed - the literals we have aren't high enough precision for f128. I have a Julia script to generate longer ones using arbitrary precision math, https://github.com/tgross35/apfloat-consts. You can just copy the consts from output.rs.
This is the other reason I haven't added too much more, clippy and CTFE both have some @rustbot label +F-f16_and_f128 |
e972a7f
to
3f29034
Compare
Oops, I used 36 significant digits for I changed |
For the clippy warning, I think clippy is already fine in nightly, so instead of adding extra clippy allows, I think I might just wait for the next beta to be cut. |
This comment has been minimized.
This comment has been minimized.
3f29034
to
2488138
Compare
This comment has been minimized.
This comment has been minimized.
NaN and infinity are not included as they require arithmetic.
NaN and infinity are not included as they require arithmetic.
2488138
to
37bec59
Compare
The job Click to see the possible cause of the failure (guessed by this bot)
|
f16
, excluding NaN and infinities as these are implemented using arithmetic forf32
andf64
.f128
, excluding NaN and infinities.std::f16::consts
.std::f128::consts
.