11
29
Fork
You've already forked ipmitool
33

remove one line from lib/ipmi_delloem.c to improve precision #32

Closed
AlexOwen wants to merge 1 commit from AlexOwen/ipmitool:alexowen-patch-1 into master
pull from: AlexOwen/ipmitool:alexowen-patch-1
merge into: IPMITool:master
IPMITool:master
IPMITool:bugfix/43-Fix-timezone-and-DST-in-SEL
IPMITool:pages
IPMITool:bugfix/fix-ci-builds
IPMITool:feature/refactor-sdr-name-handling
IPMITool:cleanup/nm
IPMITool:feature/add-support-for-boot-mailbox
IPMITool:codefactor
IPMITool:bugfix/26
First-time contributor
Copy link

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! 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.

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.
AlexanderAmelkin left a comment
Copy link

Can't accept this patch as is as it breaks the code instead of fixing it

Can't accept this patch as is as it breaks the code instead of fixing it

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
IPMITool/ipmitool!32
Reference in a new issue
IPMITool/ipmitool
No description provided.
Delete branch "AlexOwen/ipmitool:alexowen-patch-1"

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?