News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

floating point question

Started by dougiem, February 25, 2005, 07:43:29 PM

Previous topic - Next topic

dougiem

How can I convert an 80bit fp result, as used in masms fpu.LIB, to a 32bit REAL4. Or is there a simmilar fpu using REAL4.  The 32bit is used in the GDI+ which I am experimenting with  :dance:
Thanks in advance,
dougiem.

Randall Hyde

Quote from: dougiem on February 25, 2005, 07:43:29 PM
How can I convert an 80bit fp result, as used in masms fpu.LIB, to a 32bit REAL4. Or is there a simmilar fpu using REAL4.  The 32bit is used in the GDI+ which I am experimenting with  :dance:
Thanks in advance,
dougiem.

If the 80-bit real is sitting in an FPU register, just use the FSTP instruction to store it into a real32 variable. This does the conversion for you.
Cheers,
Randy Hyde

AeroASM

I would just program the FPU directly, rather than use the library, because it is much faster and more flexible. You can also use any of REAL4,REAL8 and REAL10.

Also consider using SSE instead of the FPU, as it is much faster.

dougiem

thanks Randall - I found the fpLib.hlp I didnt know i had - I understand the mechanics of the instruction now.
I am not fammiliar with SSE, AeroAsm any directions?

AeroASM

SSE only works with REAL4 and REAL8, however you can operate on up to four REAL4s or two REAL8s at the same time. Even if you don't use this parallel processing idea, it is still much faster than the FPU.

Mark_Larson

Quote from: AeroASM on February 26, 2005, 07:07:02 AM
SSE only works with REAL4 and REAL8, however you can operate on up to four REAL4s or two REAL8s at the same time. Even if you don't use this parallel processing idea, it is still much faster than the FPU.

  You can also use the scalar SSE and SSE2 instructions.  They operate on 1 real4 or real8.  I use them in place of floating point code ( which is why Intel made them in the first place).  There are a few instructions you can't do like sin/cos. 
BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm