[Cfp-interest] printf, NaN, infinity
Mike Cowlishaw
mfc at speleotrove.com
Mon Nov 26 09:40:36 PST 2018
For what it's worth, decNumber uses a quite simple NAN -> chars conversion
that is bounded; being essentially
[signbit] ['s'] NaN [payload]
where signbit is '-' if the sign bit is 1, 's' is added for signalling NaN,
and payload is the payload as an integer (omitted if the payload is 0).
e.g.:
NaN
NaN101
-Nan12345
sNaN
sNaN12
All simply parsed, etc -- many examples in my testcases. Perhaps something
similar would work for binary NaNs?
Mike
> -----Original Message-----
> From: cfp-interest-bounces at oakapple.net
> [mailto:cfp-interest-bounces at oakapple.net] On Behalf Of Fred
> J. Tydeman
> Sent: 26 November 2018 16:39
> To: Jim Thomas
> Cc: CFP
> Subject: Re: [Cfp-interest] printf, NaN, infinity
>
> On Mon, 26 Nov 2018 08:27:15 -0800 Jim Thomas wrote:
> >
> >Is this proposal at the request of WG14? If so, what exactly
> was requested?
>
> Not exactly. Martin Sebor presented a paper showing that the
> output of the form NaN(chars) is unbounded, so is a security
> problem. He presented an idea on how to limit that output.
> The committee did not like his idea. So, I decided to come
> up with my own solution.
>
>
>
> ---
> Fred J. Tydeman Tydeman Consulting
> tydeman at tybor.com Testing, numerics, programming
> +1 (702) 608-6093 Vice-chair of PL22.11 (ANSI "C")
> Sample C99+FPCE tests: http://www.tybor.com Savers sleep
> well, investors eat well, spenders work forever.
>
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest
>
More information about the Cfp-interest
mailing list