Edit: My suspicion is that the electrical power source is somehow supplying more electrical power to the laptop than before, but I don’t know if that’s possible.
An 8 bit integer can go from 0-255. So battery status would need at least 7 bits, and 8 is a pretty standard size, so it makes sense they store it that way.
Can’t go negative, but it definitely isn’t zero on the battery, so it wrapped around.
An 8 bit integer can either be treated as a signed value or an unsigned value. The difference is whether the highest bit is a value or the sign indicator. A signed integer therefore ranges from -128 to +127, and an unsigned integer ranges from 0 to 255.
In computer programming, if a function generally returns a positive integer, it is very common for an error code from the function to be a negative number, and the commonly used generic all-purpose error code is -1. In this case, you have a temperature which is a percent, so it’s expected to be in the range of 0 to 100. If you take the signed value of -1 and display it as an unsigned integer, you end up with a value of 255.
This makes me think that whoever wrote the function that checks the battery probably returns a number from 0 to 100 if it can read the state of the battery, and -1 if it can’t read the state of the battery for some reason. But whoever wrote the GUI to display the number just spits out the number as an unsigned value and doesn’t bother to do any error checking on the number that comes back from the battery function.
This type of thing is very common in computer programming.
Right, to elaborate on that, AIs in the game had an aggressiveness rating, stored as some sort of unsigned integer, and there were various circumstances that could modify that value. Gandhi, as might be expected, had a very low aggressiveness rating, meaning that he would be very unlikely to start a war or use nukes even once a war started. But if things happened to make him even MORE peaceful, like him switching to the Democracy form of government, then his aggressiveness actually went slightly negative, which meant that it was interpreted by the game as an extremely large positive number (i.e., much higher than those numbers were supposed to go), and so he went medieval (or industrial, or modern) on your ass.
In OP’s and Chronos’ examples, a negative number appears to be a large positive number. The opposite can also happen.
I was alerted the very first time IBM’s DOS/VS operating system attempted to boot on a machine with 4 Megs of physical memory. It thought it had negative memory and refused to boot!
(No, that’s not a misprint: ‘Megs’ not ‘Gigs.’ And in the mid 1970’s, 4 Megs of main memory cost well over $100,000.)
Ha! Saw this thread and checked my old Dell that I am using to write this, which has the battery removed - hovering over the battery/power symbol reveals “255% available”. I guess this is pretty consistent in the industry. Interesting.