-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Tracking Issue for float_next_up_down
#91399
Comments
During merging of my implementation a new unresolved question popped up due to failed tests: What should we do when the platform flushes denormals to zero and/or does not preserve NaN payloads?I thought that my implementation would be immune to these issues since I call For example, it appears that Rust on some x87 platforms flushes denormals and destroys NaN payloads on function boundaries. I don't know what the right way to handle this is. Maybe a careful look needs to be taken at when Rust stores data in floating point vs integer registers when Alternatively we add a disclaimer to the documentation for |
CC @workingjubilee who has recently been thinking some about platforms like x87 and such. |
What are the common usages for these two functions? I met a use case, that is to parse a float into a rational number with simpler form, which requires me to get the rounding interval. This can be done using these two functions.
Is there anybody actually enumerating floats like this? In my case it's okay to document the behavior that the function will skip subnormals in certain platforms. (Note: IEEE 754 doesn't have any explicit rule about executing |
I can comment on my use case for this function. I'm doing research on high-performance floating-point operations that requires me to iterate through floating-point numbers in this way to determine intervals for an input. My current workaround is manually converting using In my work we already treat denormals as a special case, so it's fine if Thanks for the work on these new functions, they are a welcome ergonomic improvement for me! I hope that they are stabilized soon. |
I am not sure what you mean by this, as implementations that do not implement subnormal numbers are nonconformant with IEEE754. I intend to address these concerns and more in a future project soon. |
I mean AFAIK IEEE 754 doesn't specify how subnormals are handled with nextUp and nextDown. |
I would expect But this is not the case, either the documentation is wrong or the implementation. Either way, shouldn't there be a test? About usage, this can be used to estimate rounding on operations. |
@peckpeck Which platform are you testing on? I can not reproduce your problem. |
@peckpeck Ah, yes, |
Ah indeed, by bad. Sorry for the noise. |
Why return |
Propagating
or perhaps in a more Rust way,
|
OK |
One possible use-case is to create smallest non-empty range if given range is |
I wanted this today to take a point in space which lies exactly on an axis-aligned plane, and make the minimal adjustment necessary to move it to one side of that plane. |
Yeah I am not aware of blockers here.
|
In that case, libs-api could you consider FCP for stabilization? @rustbot label +I-libs-api-nominated |
Feature gate:
#![feature(float_next_up_down)]
This is a tracking issue for two argumentless methods to f32/f64, next_up and next_down. These functions are specified in the IEEE 754 standard, and provide the capability to enumerate floating point values in order.
Public API
Steps / History
Unresolved Questions
float_next_up_down
#91399 (comment)The text was updated successfully, but these errors were encountered: