Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
I'm sure its just the way Mathcad displays hexadecimal numbers - -35 is the correct number though.
Mike
Actually, Mathcad converts 53 to hexadecimal and keeps the negative sign as it is..
If I am not wrong equivalent hexadecimal for -53 would be CB..
-Raj
Excel returns
=DEC2HEX(-53) | Converts decimal -53 to hexadecimal (FFFFFFFFCA) |
Mike
My Excel returns FFFFFFCB which is the correct 2's complement value. Adding the result CA and 35 gives FF, which = -1 and is incorrect. Mike, looks like your computer (or Excel) needs a remedial math class :-).
Lou
Lou,
I have just re-checked my Excel and got FFFFFFFCB.
Mike, looks like your computer (or Excel) needs a remedial math class :-).
Me and my computer
Mike
I haven't used the display format to view results in hex, but sticking a minus sign in front of a hex number may be mathematically OK (arbitrary base and all that), but it doesn't seem useful. I had made a routine(attached) that gives hex strings for both pos and neg numbers, using 2's complement form. Does this help?
Lou
Thanks Lou. It works great..
However, I am wondering whether it is a known limitation of Mathcad or Am I missing something?
-Raj
Hexadecimal base is like any other, and negative numbers must to have a representation that must to be the same at any base. There are some "specials" bases: 2 (the minimal of the infinite set of possible bases), 10 (whe have 10 thingers), 16 (is easy converting between base 2 and 16). There are also other usual basis: 12 (eggs are sold by dozens!) 24 and 60 (fond it in the clock) 360 (a babilonian's mistake evaluating the year; we now measute angles in this base).
So, what you're missing is the environment of application. Mathcad answer is correct, just because in general engineering all values are needed, not only the complement to 2^16, this is what is Lou's function do. This is correct in the environment of computation, because you must to take the control over the carriage bit when a operation exceed the usual limit for storage, and have not sense take lowest negative integers as results.
Regards. Alvaro.