Re: [PATCH RFC 2/3] lib: test-kstrtox: add E notation tests for kstrto[u]dec64()

From: Andy Shevchenko

Date: Thu Oct 01 2026 - 15:21:16 EST


On Thu, Oct 01, 2026 at 12:34:57PM -0300, Rodrigo Alencar via B4 Relay wrote:

> Cover E notation parsing in kstrtoudec64() and kstrtodec64(): positive,
> zero and negative exponents, upper case 'E', an explicit '+' sign,
> truncation of integer digits by negative exponents, large values, and
> failures for overflowing or incomplete exponents.

...

> {"0.2", 20},
> {"0.18446744073709551616", 20},
> {"1", 20},
> + /* E notation: exponent causes overflow */
> + {"1e21", 1},
> + {"2e20", 1},
> + /* E notation: no digits after exponent marker */
> + {"1e", 3},
> + /* E notation: sign only after exponent marker */
> + {"1e+", 3},
> + {"1e-", 3},

I would also consider something like

1ee // double 'e'
1e+0b // an attempt to have a hexadecimal exponent

--
With Best Regards,
Andy Shevchenko