News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Work with Fpu

Started by ragdog, December 30, 2015, 04:57:54 AM

Previous topic - Next topic

ragdog

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

raymond

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
Whenever you assume something, you risk being wrong half the time.
https://masm32.com/masmcode/rayfil/index.html

ragdog

Thanks Raymond for this Tutorial

Jochen have told me the solution i for integer fild Bytes  :t

Mikl__

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

raymond

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.
Whenever you assume something, you risk being wrong half the time.
https://masm32.com/masmcode/rayfil/index.html

K_F

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
;)
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

ragdog

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