flat assembler
Message board for the users of flat assembler.
Index
> Main > fpu fild |
Author |
|
ProphetOfDoom 07 Mar 2011, 23:01
I think the FPU assumes that 3FFF has been added to the exponent (it's called a "biased" exponent). So to get the real exponent value, you subtract 3FFF from the exponent value your debugger is showing you. Your calculations should all work out then. (The bias is different for qwords and dwords). I got this from:
http://www.website.masmforum.com/tutorials/fptute/fpuchap2.htm#real10 |
|||
07 Mar 2011, 23:01 |
|
b1528932 08 Mar 2011, 10:26
thank you, but i managed to understand it myself.
when you have a float representation SEEEEEMMMMMMMMMM its real value is equivalent to: sign tells if its + or -, nothing more, just sign. E is exponent. MSB = 0, rest = 1 (0111111...) is 0. in order to convert to real number, you have to add it (depends on ammount of exponent bits). For example is you have 7 exponent bits, 0 is 0111111, 1 is 1000000, 2 is 1000001, and so on. -1 is 0111110, etc. M is mantisa. lets say exponent is 1000101 (1000101 - 0111111 = 110 (6)). mantisa is 011010 (22). real number is 0 * 2^6 = 0 1 * 2^5 = 32 1 * 2^4 = 16 0 * 2^3 = 0 1 * 2^2 = 4 0 * 2^1 = 0 32+16+4 = 52. sign is 0, so +52. lets check in bochs: +52 4004D000000000000000 0 100000000000100 1101000000000... exponent = 100000000000100 - 011111111111111 = 101 (5) mantisa = 11 1 * 2^5 = 32 1 * 2^4 = 16 0 * 2^3 = 0 1 * 2^2 = 4 0 * 2^1 = 0 0 * 2^0 = 0 0 * 2^-1 = 0 0 * 2^-2 = 0 0 * 2^-3 = 0 0 * 2^-4 = 0 ... 0 * 2^-58 = 0 32 + 16 + 4 = 52 |
|||
08 Mar 2011, 10:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.