Hello, i'm having a problem about floating point division and hope someone can help me
here is my code


                ;this is supposed to load in stack of FPU
                FLDPI ;Loads PI =3,1415...  in  the stack of FPU
              FLD1 ;Loads a 1  in  the stack of FPU

              FDIV ; PI/1 
                FBSTP NumOro          ; Now load the result in  NumOro, the declaration is: "NumOro  dd 0" 

And all i get is a 3, why???????
please someone help me..............
Posted on 2005-10-09 22:43:21 by zaiboot
You should find an answer to your problem at:

http://www.ray.masmcode.com/tutorial/fpuchap6.htm#fbstp

Raymond
Posted on 2005-10-09 23:03:01 by Raymond
...why divide by 1 anyway? :-s
Posted on 2005-10-10 00:20:58 by f0dder
excuse me for my poor english.
I think you should to see the examples of fup IN the MASM32 packaged.
This examples will show you how to translate a FLOAT number to a CHAR number.
Because your 'NumOro' is a DWORD, and it dos not contain a digital.  :P
Posted on 2005-10-18 06:28:01 by miaomiao
I don't see how it assembled with NumOro as a dd,
the FBSTP instruction, stores a BCD number and POPs it from the stack,
only assembled when I used the dt data type.

The BCD becomes a rounded integer for storing to memory.
Attachments:
Posted on 2005-10-18 14:00:37 by dsouza123
Your bcd number requires 10 bytes of storage, not 4.  Why are you storing you number as a bcd number?.  There is a function in the masm.lib that turns floaing point number into text: FPTOA, use this function to output floating point properly. ;)
Posted on 2005-10-19 00:52:00 by GorillaCoder