You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a tracking issue for integer constants that represent the range of consecutive values that can be losslessly round-tripped to and from the corresponding floating point type. Additionally, integers within this range will convert to a floating point value that no other integer will convert to.
Public API
These constants are defined as ±(2mantissa_digits-1).
Based on the options we've seen, we feel like MAX_EXACT_INTEGER is a good balance between clarity and brevity. It does still have the property that one could interpret it as allowing one integer larger because that integer's truncated low bit would be 0, but we felt like any name trying to capture that property (and make it clear that the correct value is one less than the appropriate power of two) would be sufficiently verbose as to be less clear.
Feature gate:
#![feature(float_exact_integer_constants)]This is a tracking issue for integer constants that represent the range of consecutive values that can be losslessly round-tripped to and from the corresponding floating point type. Additionally, integers within this range will convert to a floating point value that no other integer will convert to.
Public API
These constants are defined as ±(2mantissa_digits-1).
Steps / History
float_exact_integer_constants#152512Unresolved Questions
MAX_EXACT_INTEGERwas determined to be the best compromise of suggested names. ACP: Add float constants for min/max limits of consecutive integers that convert to unique floats libs-team#713 (comment):Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩