mirror of
https://github.com/nushell/nushell.git
synced 2026-10-28 17:05:03 +08:00
## Description Filesize and duration literals lose precision because `parse_unit_value` parses the numeric part through an `f64`. `Filesize` is backed by an `i64`, so large exact integers get silently rounded — e.g. `6504534684301572998b` parses as `6504534684301573120b`, off by 122 bytes (#10612). This parses the numeric part as an `i64` when it's a whole number and computes the base-unit value (bytes / nanoseconds) with checked integer arithmetic. Fractional literals, and anything that would overflow `i64`, fall back to the existing `f64` path, so everything that already worked is unchanged. The unit factors are all whole numbers, so the integer conversion is lossless. ## User-facing changes (Release notes) - Fixed large whole-number filesize and duration literals (e.g. `6504534684301572998b`) losing precision when parsed. ## Additional notes Fixes #10612