pcp
[Top] [All Lists]

Re: Floating point problem

To: Martin Spier <mspier@xxxxxxxxxxx>
Subject: Re: Floating point problem
From: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date: Thu, 31 Jul 2014 07:49:38 +1000
Cc: "Frank Ch. Eigler" <fche@xxxxxxxxxx>, 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: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0
On 31/07/14 04:35, Martin Spier wrote:
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? 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. It's not clean and
nice, but it might work. On the client side (JavaScript) I can convert
that to a BigDecimal and work with it.

Hi all.

The problem is (a) the derived metric has the wrong semantics ... counter not delta(counter) and (b) the derived metric involves division ... this will never produce an integer result.

I you don't use derived metrics and do all of the rate and percentage arithmetic on the client side (option 2. in my original mail), the problem goes away.

Otherwise, you need an implementation of option 1. or 3.

I've started working on 3.

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