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
Would be nice to add a small_float macro, rounding out (pun intended) numeric primitive support in this library. Unfortunately, determining when a lossless cast from an f64 constant to an f32 equivalent can be done is non-trivial. Due to the specifics of IEEE 754-2008, it’s not as simple as checking (($val as f32) as f64) == ($val as f64).
Maybe understanding how std::num::flt2dec works in supporting Debug for floats might provide some insight. If precision is not explicitly specified when printing, flt2dec helps determine the smallest significant precision (not reflected with an == comparison). But I’m not sure this methodology is 1) actually the desired solution here or 2) possible to implement in a macro_rules macro.
The text was updated successfully, but these errors were encountered:
Would be nice to add a
small_float
macro, rounding out (pun intended) numeric primitive support in this library. Unfortunately, determining when a lossless cast from anf64
constant to anf32
equivalent can be done is non-trivial. Due to the specifics of IEEE 754-2008, it’s not as simple as checking(($val as f32) as f64) == ($val as f64)
.Maybe understanding how
std::num::flt2dec
works in supportingDebug
for floats might provide some insight. If precision is not explicitly specified when printing,flt2dec
helps determine the smallest significant precision (not reflected with an==
comparison). But I’m not sure this methodology is 1) actually the desired solution here or 2) possible to implement in amacro_rules
macro.The text was updated successfully, but these errors were encountered: