Log in

View Full Version : Extended Precision representation


r3aper
March 18th, 2009, 18:58
Hi fellow reversers!

I am trying to solve a CrackMe but I'm having some technical difficulties regarding the FPU.

I've read the IEEE 754 (which is the Standard for Binary Floating-Point Arithmetic) and the paper "What Every Computer Scientist Should Know About Floating-Point Arithmetic", they are both very explicit but, in practice, I still don't understand something regarding the extended precision (80bit floating point).

For instance take the number 1.234567890000000 if we were to encode this number into hex we would get 3FFF 9E065214 1EF0DBF6, which is exactly what we get if we load the number into the ST register of the FPU. What I don't understand is that if we were to load that number into the ST register by using FST memory_address (or any other command) the value that must be located in the memory addres is 1BDE8342 CAC0F33F.

So how should we read 1BDE8342 CAC0F33F to end up with 1.234567890000000 ?

Thanks,
r3aper

fr33ke
March 18th, 2009, 23:45
The bits are split into the sign, the exponent and the fraction, and the result is (+ or -) fraction * 2exponent. The details are in IEEE 754 ( http://en.wikipedia.org/wiki/IEEE_754-1985 ) and you can play with it at http://babbage.cs.qc.edu/IEEE-754/ (the bytes may seem reversed because of big/little endians).

r3aper
March 19th, 2009, 00:03
I had already been to that site, but I forgot about the endians (actually I didn't forgot but I did something stupid, I tried this CAC0F33F 1BDE8342 instead of 3FF3C0CA 4283DE1B... Silly me...

Thanks!