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..............

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..............

You should find an answer to your problem at:

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

Raymond

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

Raymond

...why divide by 1 anyway? :-s

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

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

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.

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.

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. ;)