Date: Thu, 1 May 2025 10:35:13 +0100
On Thu, 1 May 2025 at 08:32, Jan Schultke via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> > I might just be stupid here but how do you plan to handle leading zeroes in
> > the fractional part of your all integers interface?
>
> You start parsing the integer at the leftmost nonzero digit to form
> the mantissa. Leading zeros don't matter in the integer part, and
> don't matter in the fractional part, except that you subtract the
> number of leading fraction zeros from the exponent.
Although then you need to increase the integer part too.
> In both 1.0 and 0.1, you start parsing the integer at 1, but the
> exponent is one lower in the latter case.
It think what Magnus is talking about is leading zeros within the
fractional part, e.g. 1.01 is not the same as 1.1e-1, it's the same as
10.1e-1, so you would want to call parse_float(10, 1, -1) not
parse_float(1,1,-1). Requiring users to get that right is an argument
in favour of passing character sequences and getting the parse_float
function to do those adjustments.
<std-proposals_at_[hidden]> wrote:
>
> > I might just be stupid here but how do you plan to handle leading zeroes in
> > the fractional part of your all integers interface?
>
> You start parsing the integer at the leftmost nonzero digit to form
> the mantissa. Leading zeros don't matter in the integer part, and
> don't matter in the fractional part, except that you subtract the
> number of leading fraction zeros from the exponent.
Although then you need to increase the integer part too.
> In both 1.0 and 0.1, you start parsing the integer at 1, but the
> exponent is one lower in the latter case.
It think what Magnus is talking about is leading zeros within the
fractional part, e.g. 1.01 is not the same as 1.1e-1, it's the same as
10.1e-1, so you would want to call parse_float(10, 1, -1) not
parse_float(1,1,-1). Requiring users to get that right is an argument
in favour of passing character sequences and getting the parse_float
function to do those adjustments.
Received on 2025-05-01 09:35:29