[Cfp-interest 2897] Re: standardize printf %a/%A

Vincent Lefevre vincent at vinc17.net
Thu Sep 7 16:38:47 PDT 2023


On 2023-09-05 19:55:38 +0200, Paul Zimmermann wrote:
> can you detail what the issue would be, for example for the three
> conventions below?
> 
> 1) force the output (when non-zero) to begin with hexadecimal digit '1'
>    (this makes it easy to grasp the magnitude of the number by looking
>    at the exponent)
> 2) for the output (when non-zero) to begin with an hexadecimal digit >= '8'
>    (this minimizes the number of hexadecimal digits)
> 3) force the radix-2 exponent to be a multiple of 4
>    (this corresponds to a radix-16 output, with the exponent converted into
>    redix 2)

Note that for double, the GNU C Library (glibc) does 1bis: the first
digit is 1, except when the value rounds to the next power of 2, in
which case the output exponent is not changed due to the rounding,
and the first digit is 2. I don't think that this is a good choice
in general. It adds information, but only in a very particular case,
and it makes comparing printed values more difficult for the user.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the Cfp-interest mailing list