This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] benchtests: Improve readability of JSON output
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Will Newton <will dot newton at linaro dot org>
- Cc: Florian Weimer <fweimer at redhat dot com>, libc-alpha <libc-alpha at sourceware dot org>
- Date: Wed, 23 Apr 2014 14:26:37 +0000
- Subject: Re: [PATCH] benchtests: Improve readability of JSON output
- Authentication-results: sourceware.org; auth=none
- References: <1396949290-21346-1-git-send-email-will dot newton at linaro dot org> <5343C311 dot 1030101 at redhat dot com> <CANu=DmjuuVwD4iVC7+fA+7jmO_CCSuHXHAuRyCA-CLqHnGbE9Q at mail dot gmail dot com> <5343CE68 dot 1080208 at redhat dot com> <CANu=DmhKGALfv4Zy5zXv6Zhzm+qKS4URfO109jnLnthS+ee5mQ at mail dot gmail dot com>
On Tue, 8 Apr 2014, Will Newton wrote:
> On 8 April 2014 11:24, Florian Weimer <fweimer@redhat.com> wrote:
> > On 04/08/2014 12:15 PM, Will Newton wrote:
> >
> >>> Getting this right is quite a challenge for other (real) JSON libraries.
> >>> They are also affected by the locale issue.
> >>
> >>
> >> Luckily we don't need to be 100% general here and we have quite a
> >> narrow use case.
> >
> >
> > Sure, it's not a problem for benchtests reporting. It's just something that
> > keeps showing up in various C JSON libraries.
> >
> > It's a pity that we don't have (on GNU/Linux at least) a canonical library
> > to get gdtoa-type functionality from.
>
> I think the "a" specifier would work but JSON does not support hex formats.
You can also use DECIMAL_DIG as the precision with "g" (presuming you are
in round-to-nearest mode for both output and input) (or FLT_DECIMAL_DIG,
DBL_DECIMAL_DIG, LDBL_DECIMAL_DIG, given C11). Is there something making
that unsuitable?
--
Joseph S. Myers
joseph@codesourcery.com