Improve precision of Dell Cumulative Energy statistic by removing the line that throws precision away!
I have a use case where this extra precision is useful.
AlexOwen/ipmitool:alexowen-patch-1 into master
Improve precision of Dell Cumulative Energy statistic by removing the line that throws precision away!
I have a use case where this extra precision is useful.
Improve precision of Dell Cumulative Energy statistic by removing the line that throws precision away!
@ -2824,7 +2824,6 @@ ipmi_powermgmt(struct ipmi_intf * intf)
remainder = (cumReading % 1000);
cumReading = cumReading / 1000;
remainder = (remainder + 50) / 100;
Looks like you're not adding precision, you're just breaking arithmetic rounding. That is, with this patch you will be getting values rounded down always, contrary to metrology rules where fractions equal or greater than 0.5 should be rounded up to nearest integer if you only have that much precision on the indicator.
Source value (x1000) Metrologically correct Original code Your code
5149 5.1 5.1 5.1
5150 5.2 5.2 5.1
5151 5.2 5.2 5.1
I don't think I can accept this patch.
If you want better precision, change division by 100 to division by 10 to get 2 digits (and then 50 to 5, of course). You will then also need %d.%02d in printf below.
Can't accept this patch as is as it breaks the code instead of fixing it
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?