diff --git a/docs/src/extensions.md b/docs/src/extensions.md index 9ea979e9571..437448837b0 100644 --- a/docs/src/extensions.md +++ b/docs/src/extensions.md @@ -145,6 +145,8 @@ matter the parameters (integers, decimal numbers, positive or negative increment format specified, etc.), so its output will be more correct than GNU coreutils for some inputs (e.g. small fractional increments where GNU coreutils uses `long double`). +This also extends the range of values that can be represented beyond GNU coreutils' `long double` maximum. + The only limitation is that the position of the decimal point is stored in a `i64`, so values smaller than 10**(-2**63) will underflow to 0, and some values larger than 10**(2**63) may overflow to infinity. diff --git a/src/uu/seq/src/seq.rs b/src/uu/seq/src/seq.rs index 7b56c26f574..b67543e9254 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -290,8 +290,8 @@ fn fast_print_seq( // Format the first number. let first_str = first.to_string(); - // Makeshift log10.ceil - let last_length = last.to_string().len(); + // Approximate length of the last number in base 10. + let last_length = (last.bits() as f64 / std::f64::consts::LOG2_10).ceil() as usize; // Allocate a large u8 buffer, that contains a preformatted string // of the number followed by the `separator`.