tain Posted June 27, 2009 Posted June 27, 2009 I've never been a numbers guy but am trying to get proficient at using calc.exe to do number conversions. A "quick reference" sheet would be ideal but I can't find one and am getting skeptical that one exists.Is there some source (tutorial, .chm, cheat sheet) that will help me perform operations such as:-257 decimal to hex big endian-257 decimal to hex little endian-23 hex little endian to binary floating point little endian (lots of conversions there)Convert the 32bit little endian hex value 12 3F 2B A7 into both signed and unsigned decimalFor example, a 16bit signed hex value (FF F6) (which happens to be negative) to a decimal:Scientific modeInput FFF6 in Hex mode with a size of Word.Perform Two's Complement: ...Click Not to invert the binary values. ...Add 1. ...Click Equals.Switch from Hex to Decimal mode.Remember that the number displayed (10) is actually negative (-10) due to the negative signed bit from the original hex value.
jaclaz Posted June 27, 2009 Posted June 27, 2009 Why not using a "dedicated" calculator? Example:http://www.wfwsoftware.com/hexit.htmljaclaz
tain Posted June 27, 2009 Author Posted June 27, 2009 That software looks very interesting and I'll certainly check it out. But unfortunately I work in an environment that prohibits electronic devices (such as a TI calc or a thumb drive) as well as internet access. So there is no way to run this software where I really need it. Thus my need to squeeze all the power out of calc.exe that I can
jaclaz Posted June 28, 2009 Posted June 28, 2009 Thus my need to squeeze all the power out of calc.exe that I can I see. And you cannot have a worksheet, like Excel/OpenOffice.org/Spread32 too? I usually do all my "hex thingies" in one of them.However, first two are easy:-257 decimal to hex big endian-257 decimal to hex little endianOn calc:Hex [x]Word [x]Dec [x]257+/-Hex [x]Result=FEFF (which is "plain" or "Motorola" or "Little Endian") you just exchange the bytes and you get ->FFFE (which is "Big Endian" or "Intel")Again:Hex [x]DWord [x]Dec [x]257+/-Hex [x]Result=FFFFFEFF (which is "plain" or "Motorola" or "Little Endian") you just exchange the bytes and you get ->FFFEFFFF (which is "Big Endian" or "Intel")For example, a 16bit signed hex value (FF F6) (which happens to be negative) to a decimal:Scientific modeInput FFF6 in Hex mode with a size of Word.Perform Two's Complement:...Click Not to invert the binary values....Add 1....Click Equals.Switch from Hex to Decimal mode.Remember that the number displayed (10) is actually negative (-10) due to the negative signed bit from the original hex value.This seems easier to me :Hex [x]Word [x]FFF6+/-Dec [x]+/-(you just need to remember to press twice the +/-, once when you input the negative Hex and once when the (positive) result is displayed)For floating point, you should take notes/study these:http://babbage.cs.qc.edu/IEEE-754/Decimal.htmlhttp://babbage.cs.qc.edu/IEEE-754/32bit.htmlhttp://babbage.cs.qc.edu/IEEE-754/64bit.htmljaclaz
tain Posted June 28, 2009 Author Posted June 28, 2009 And you cannot have a worksheet, like Excel/OpenOffice.org/Spread32 too? Potentially. But 1) I need to be mobile 2) There are multiple, independent networks in the same physical environment so I couldn't always transfer a spreadsheet around.You methods look good, but you got the Endianness reversed. Intel is Little Endian whereas Motorola is Big.Here is a stupid question from a non-math guy: why did you change from word to dword? The math is the same except for the extra 1-bits (Fs). Are you trying to change the endianness in the calcuator or are you trying to manually display the extra bits at the end to make it easier to remember the full state?This seems easier to me :Hex [x]Word [x]FFF6+/-Dec [x]+/-That is certainly a faster/easier way to do it. But the behavior or +/- is not consistent in my calc. For example, if you go back to hex at the end of the steps you outlined and then hit +/- again you will get 'A' instead of '-FFF6'. Why does the behavior change?I will study these and pose questions soon For floating point, you should take notes/study these:http://babbage.cs.qc.edu/IEEE-754/Decimal.htmlhttp://babbage.cs.qc.edu/IEEE-754/32bit.htmlhttp://babbage.cs.qc.edu/IEEE-754/64bit.html
jaclaz Posted June 29, 2009 Posted June 29, 2009 (edited) You methods look good, but you got the Endianness reversed. Intel is Little Endian whereas Motorola is Big.You are right, my bad. Here is a stupid question from a non-math guy: why did you change from word to dword? The math is the same except for the extra 1-bits (Fs). Are you trying to change the endianness in the calcuator or are you trying to manually display the extra bits at the end to make it easier to remember the full state?No, it was just an example, from another non-math guy. That is certainly a faster/easier way to do it. But the behavior or +/- is not consistent in my calc. For example, if you go back to hex at the end of the steps you outlined and then hit +/- again you will get 'A' instead of '-FFF6'. Why does the behavior change?Well, yes , but not exactly.Hex [x]FFF6+/- -> -FFF6Number is somehow "parsed" and put in the stack only now. (but the value of the stack is actually "A", which then converts nicely to "10")Dec [x] -> 10+/- -> -10Hex [x] ->FFF6Number is already into the stack.+/- -> ADec [x] -> 10+/- -> -10Hex [x] ->FFF6etc. etc.It seems like calc.exe "autoconverts" negative hex values to positive ones.Try the following:Hex [x]0-A= -> FFF6+/- -> ADec [x] -> 10+/- -> -10and loop as per above.In other words, when you know that you are dealing with a negative hex number you need to press twice +/-, once in Hex[x] and once in Dec[x], when converting to Dec.jaclaz Edited June 29, 2009 by jaclaz
spacesurfer Posted July 1, 2009 Posted July 1, 2009 interesting conversation there!! i can't understand a word of it!! haha.
jaclaz Posted July 1, 2009 Posted July 1, 2009 interesting conversation there!! i can't understand a word of it!! haha.There are 10 kinds of people....:http://www.oreillynet.com/etel/blog/2004/0...f_people_e.htmlPossible soundtrack theme:Do you think I'm hexy? B) It would come out as a hit among geeks. jaclaz
spacesurfer Posted July 1, 2009 Posted July 1, 2009 There are two kinds of people, those who really know their medications and dosages and those who do not.Scary I take this little pink one at night, 1/2 of this big pale yellow one in the morning, and this white oval one when I feel it coming on!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now