Merged
Conversation
22ccafc to
2f20a06
Compare
2f20a06 to
299e9cc
Compare
299e9cc to
cd02b13
Compare
The previous implementation was incorrect when temp = 2732, expected 0.05, got -0.14
cd02b13 to
01bdbba
Compare
shirou
approved these changes
Jan 29, 2026
Owner
shirou
left a comment
There was a problem hiding this comment.
Good catch! According to the document, WMI returns "tenths of degrees Kelvin", so the correct formula is temp / 10 - 273.15.
But since temp is uint32, temp/10 performs integer division and loses precision. This PR avoids that by using (temp*10 - 27315) / 100, which is mathematically equivalent but keeps everything in integers before the final division. And it also makes the code simpler. Great!
This was referenced Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous implementation was incorrect
when temp = 2732, expected 0.05, got -0.14