serso / android-calculatorpp

Android Calculator
421 stars 201 forks source link

[BUG] (-i)^2!=-1 #194

Open nagayev opened 6 years ago

nagayev commented 6 years ago

-i^2==-1 But (-i)^2==F FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF System:HEXadecimal

Erhannis commented 5 years ago

Yeah, check -1 in hex - it's given as FFFFFFF... as well. Which is technically a correct representation, in two's complement form (assuming the number of bits is right, which I dunno). It's just not how most people would choose to show a negative number. Personally, I think there's an argument for having both representations available. (One for truer math, the other for more accurate computer-internal representations - though I think the latter would be more useful if you could specify the available bit-width.)