I used WireShark to capture this double-precision float from ethernet: 40 39 64 15 85 15 4f 4f Basic format understanding: [sign bit][11 bit exponent][52 bit mantissa] = 64 bit value I believe it's in big-endian order, equivalent to approximately 52,000 decimal. No matter how I order the bytes it never comes out right. asked 02 Nov '12, 09:30 Roy L Payne |
3 Answers:
52000 would be 0x40E9640000000000, so no matter if you use big/little endian, you will not end up with your hex representation. So, where did capture that double float and how do you know it's the representation of the double float value 52000? Can you post the capture file that contains that value (on cloudshark.org)? Regards answered 02 Nov '12, 09:42 Kurt Knochner ♦ |
If you need the value for some reason other than to simply display it, you can use answered 02 Nov '12, 13:00 cmaynard ♦♦ |
ScriptingIf you have more hex strings than is convenient for manual entry, I would employ scripting. You could even use this Python script directly in codepad. IEEE-754 Analysis from CUNYI like using the IEEE-754 Analysis page to convert hex strings (copied from Wireshark/Tshark or similar tools) to decimal values. It also converts decimal floating-point to hex string, handles endianness, and displays the conversion in different precisions. Instructions
answered 02 Nov '12, 18:11 helloworld |
Kurt, thanks for feedback. I'm Richard (Roy L Payne), and comparing your number with mine, I realized I typo'd part of it ('39' should be 'e9'). So mine starts with "40 e9 64", which matches the start of your number. I'll have to track down what all that other garbage is in my value. About posting files, it won't be possible. Thanks again for your help.
The "other garbage" may be "it's approximately 52000, not exactly 52000".
if you use the online converter (see link above), you will get the decimal representation.
Result: 5.20006724955128665897063910961E4
So, the rest is not really "garbage", but an essential part of the value, if it's a double float value. As @Guy Harris said: It's approximately 52000. And that's what you also assumed in your question:
So, I think the puzzle is solved ;-)
Regards
Kurt