The MASM Forum

General => The Campus => Topic started by: ragdog on December 30, 2015, 04:57:54 AM

Title: Work with Fpu
Post by: ragdog on December 30, 2015, 04:57:54 AM
Hello

I try to work with Fpu but i cannot get the correct result what is wrong?


.const
mb REAL4 1048576.0f
.data
Bytes qword 200000000
.data?
qwBytes qword ?
.code
fld Bytes
FDIV mb
fstp qwBytes
invoke crt_printf,chr$ ("%.2f Bytes"),qwBytes


And how i can get the remainder with fdiv in eax edx?

Regards
Title: Re: Work with Fpu
Post by: raymond on December 30, 2015, 05:28:38 AM
It would seem that you know absolutely nothing about the fpu nor of its instructions.

I would thus strongly recommend that, before you attempt using fpu instructions, you start by looking at a relevant tutorial such as the one available in the MASM32 SDK in its /tutorial/fputute subdirectory. If you don't have the SDK, you can view and/or download that tutorial from
http://www.ray.masmcode.com/fpu.html
Title: Re: Work with Fpu
Post by: ragdog on December 30, 2015, 09:09:03 PM
Thanks Raymond for this Tutorial

Jochen have told me the solution i for integer fild Bytes  :t
Title: Re: Work with Fpu
Post by: Mikl__ on December 31, 2015, 12:37:57 PM
Hi, ragdog!
Quote.data
      Bytes qword 200000000
   .data?
      qwBytes qword ?
   .code
   fld Bytes <-- may be fild ?
Sorry, I later saw the answer
QuoteJochen have told me the solution i for integer fild Bytes  :t
Title: Re: Work with Fpu
Post by: raymond on December 31, 2015, 04:02:33 PM
Quote from: Mikl__ on December 31, 2015, 12:37:57 PM
Hi, ragdog!
Quote.data
   fld Bytes <-- may be fild ?
Sorry, I later saw the answer
QuoteJochen have told me the solution i for integer fild Bytes  :t

Sorry, but that was not the only mistake in four lines of code. That's why I strongly suggested the tutorial.
Title: Re: Work with Fpu
Post by: K_F on December 31, 2015, 05:14:58 PM
Although I'd knew the FPU workings for many moon's, I only started seriously using it after going through Raymond's tuts  :t
Now I crunch Reals like a breakfast serial..  :icon_mrgreen:

Raymond.. ever thought of doing something similar for MMX/XMM/SSE.. etc
;)
Title: Re: Work with Fpu
Post by: ragdog on December 31, 2015, 07:14:07 PM
QuoteSorry, but that was not the only mistake in four lines of code. That's why I strongly suggested the tutorial.

Right Ray and your Tutorial is good :t