pcp
[Top] [All Lists]

Re: Floating point problem

To: Martin Spier <mspier@xxxxxxxxxxx>
Subject: Re: Floating point problem
From: "Frank Ch. Eigler" <fche@xxxxxxxxxx>
Date: Wed, 30 Jul 2014 15:40:37 -0400
Cc: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>, pcp@xxxxxxxxxxx, Amer Ather <aather@xxxxxxxxxxx>, Coburn Watson <cwatson@xxxxxxxxxxx>, Brendan Gregg <bgregg@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <CAEp4+dWxmB29-BYrM2GRmoC2j7T2bAEXf0UGAdzt7OAqzNWZ=A@xxxxxxxxxxxxxx>
References: <CAEp4+dU2kE9JJztBPc=N5oSyoEyBvN5Of19rohC3DxXGeomuRw@xxxxxxxxxxxxxx> <033501cfa8a4$fd091ed0$f71b5c70$@internode.on.net> <CAEp4+dUH6fEQ2E=o5O2q8LKfR2xUypM-AeOwQhWy9sEntvO-AQ@xxxxxxxxxxxxxx> <53D6CE6A.8030309@xxxxxxxxxxxxxxxx> <y0mbns92ek8.fsf@xxxxxxxx> <53D73CBF.9090008@xxxxxxxxxxxxxxxx> <CAEp4+dWxmB29-BYrM2GRmoC2j7T2bAEXf0UGAdzt7OAqzNWZ=A@xxxxxxxxxxxxxx>
User-agent: Mutt/1.4.2.2i
Hi -

> I'm not familiar with PCP's code so I might be completely wide of
> the mark here, but my understanding is that it's a precision
> problem. Aren't int64 or GMP (https://gmplib.org/) options in this
> case?

Doing derived-metric calculations in int64 form sounds possible, but
effort would have to be expended to define casting and rules, and
given pure C libpcp, some unpleasant code duplication would be needed.


> There's also the JSON conversion problem, but one option in this
> case is sending out a String in the JSON response instead of a
> number. [...]

pmwebd was using the equivalent of printf("%g"), which suffers from a
too-low default precision.  The fche/pmwebd branch switches to a
type-appropriate number of digits of precision, so this part should be
better.  But even with that, one will have only 52 bits bits of
precision/mantissa, fewer than with a 64-bit integer.

- FChE

<Prev in Thread] Current Thread [Next in Thread>