Available on crate feature
lossless-float only.Expand description
A float that refuses to silently lose information (requires
lossless-float feature) — the floating-point sibling of
lossless-u64.
A float that refuses to silently lose information.
LosslessFloat is the floating-point sibling of the
lossless-u64 feature’s integer guarantee: an opt-in “refuse to
silently lose precision” number type. Deserialization rejects
infinities, NaN, and any value that does not survive a
format-and-reparse round trip, so a config field declared
LosslessFloat can never quietly hold a distorted number.
Formerly noyalib::robotics::StrictFloat — the mechanism was
never robotics-specific, only the label; the robotics module
carried deprecated aliases for one release (v0.0.29) and was
removed in v0.0.30.
§Examples
use noyalib::lossless_float::LosslessFloat;
let f: LosslessFloat = noyalib::from_str("3.14159").unwrap();
assert!((f.get() - 3.14159).abs() < 1e-10);
// Infinity is rejected.
let result: Result<LosslessFloat, _> = noyalib::from_str(".inf");
assert!(result.is_err());Structs§
- Lossless
Float - A float that rejects values outside f64’s precise representation range.
- Lossless
Float Error - Error returned when a float value fails the precision check.