groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pic anomalies


From: Doug McIlroy
Subject: Re: pic anomalies
Date: Tue, 31 Dec 2019 10:39:53 -0500
User-agent: Heirloom mailx 12.5 7/5/10

> Getting back on topic, are we sure we want to deviate from GNU pic's
> current behaviour without checking historical norms of other pics?
>
>     $ printf '%s\n' \
>         .PS 'print sprintf("%.17g %.0f% % %%", 3.14, 42, 99)' .PE |
>     > pic >/dev/null
>     3.1400000000000001 42% % %%
>
> Though that may seem odd to our modern C-standardised eyes, it's
> understandable in that if it isn't a valid %f, etc., format specifier
> then it's a literal percent sign.

It looks like Ralph has turned up a really strange bug in pic
that suppresses pic's usual diagnosis of a bare % in a format.

The example can be boiled down to
        sprintf("%g% %",1)
which produces
        1% %
without complaint. If you omit either the 2nd or 3rd % though,
pic announces "bad sprintf format".

Doug



reply via email to

[Prev in Thread] Current Thread [Next in Thread]