Pyrpolizer wrote:GR I was expecting an answer along the lines that computers use additional "tricks" to the pure mathematical value of binary numbers. After all binary numbers are only used by computers, so it's their problem.
So unless you trick the scientific calculator of windows by deleting the leftmost digit you will never get it to give you 10111010=-58. It will always give you +186. The reason is, the windows calculator works purely mathematically, and doesn’t care if you use 8 bit or 16 bit or 32 bits.
True or not?
Pyro, the Windows calculator is just another computer program that SIMULATES a calculator so the onus was on the programmer who wrote it how to deal with negative number conversions and unfortunately he did… NOTHING! All he had to do to fix the problem is this… (pseudo code follows…)
The variable “Number” used below represents the number to be converted from Decimal to Binary…
IF (Number<0) THEN <-- This is the CONDITION required to filter negatives
BEGIN
(All negatives come in here so you can SET bit 1 in answer)
END ELSE
BEGIN
(All positives come in here so DO NOT change bit 1 in answer)
END.
Had the Windows calculator displayed an “error” when trying to convert a negative decimal number to Oct, Bin, or Hex, then I would’ve given the programmer some credit for at least DETECTING such a likely scenario but instead it displays GARBAGE!
This clearly falls under the description of a “BUG” and should be reported to Microsoft.
Given that this calculator calls itself “scientific” then you’d think that it would handle negatives more gracefully.
Regards, GR.