C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Low-level float parsing functions

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Wed, 30 Apr 2025 21:08:44 +0100
On Wed, 30 Apr 2025, 20:32 Zhihao Yuan, <zy_at_[hidden]> wrote:

> On Wednesday, April 30th, 2025 at 11:11 AM, Jan Schultke <
> janschultke_at_[hidden]> wrote:
>
> I don't think it makes much sense to use _BitInt for this, even if it was
> in the standard, which it isn't.
>
>
> We will reference C23 soon, so it is.
>

No it isn't.



>
> You wouldn't need to parse in this function; the two byte spans would
> contain the little-endian bits of the variable-length integers that make up
> the integer and fraction. I don't see a compelling reason why you would
> take in the integer and fraction as an integer type. You're still passing
> the same data.
>
>
> Oh, I see. We originate from the same idea.
> As a side note, std::span<const std::byte>
> could be used to make this clearer.
> If we further talk about variable length
> bits vs. fixed-length bits (_BitInt(K) or
> std::array<std::byte>), I slightly prefer the latter
> because when comes to to_chars, there is
> some advantage to exchange the data
> via return value, in which case span​
> can't be reused as it defines no storage.
>
> Regardless this is less important than the
> point: no parse and no format.
>
> --
> Zhihao Yuan, ID lichray
> The best way to predict the future is to invent it.
> _______________________________________________
>
>

Received on 2025-04-30 20:09:05