On 22 September 2011 22:21, Steve Friedl <st...@unixwiz.net> wrote:
> No, the variable it's dividing is long long - the missing dot was an error
> in posting the patch (though I did all the testing with the right way).

Errr... no.
>From the 5.7.1.rc3 tarball:

static int _percent( unsigned long long value, unsigned long long total ) {
    float v=value, t=total, pct;

    /* avoid division by zero */
    if (total == 0)
        return 0;

    pct  = (v*100)/t;   /* Calculate percentage using floating point
                           arithmetic, to avoid overflow errors */
    pct += 0.5;         /* rounding */
    return (int)pct;
}


'v*100' is float times integer,
so surely the result should be float, as required?

Dave

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to