diff --git a/docs/src/extensions.md b/docs/src/extensions.md index 489886394e2..77805f0432f 100644 --- a/docs/src/extensions.md +++ b/docs/src/extensions.md @@ -167,6 +167,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 e661b4f7a28..10a950fd1f4 100644 --- a/src/uu/seq/src/seq.rs +++ b/src/uu/seq/src/seq.rs @@ -309,8 +309,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`.