Has ayone done this?

Convert a number to float or double in IEEE Format?

I got a question here . If IEEE format is 32 bits for single and 64 bits for double.

How can I store 64bits if general registers are 32bits long?
Posted on 2005-04-10 23:47:07 by luisvalencia
FASM syntax:

fld dword ; assuming you have a 32 bits integer there

Now your integer is in the FPU stack; to get it back in IEEE format, just do this:

fstp dword/qword/tword ; use the size you want, 32, 64 or 80 bits

So, you store these 32/64/80 bits numbers in memory. You can't pass values to the FPU through the registers, only through memory.
Posted on 2005-04-11 04:48:58 by El_Choni
I'm guessing that again your teacher wants you to convert an integer by hand (not using the FPU).

As you are converting an integer to FP format, you don't need to worry about NaNs or infinite (as they can't be expressed as integers).
You do however need to worry about zero, take care of this case first it makes things easier.

Remember that the exponent is biased by -127.

If you need 64 bits, and you've only got a 32 bit processor (like the x86) then you use two registers. It's not brain science.

Do you do any of your own homework?
Posted on 2005-04-11 10:26:02 by Mirno