The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: RedGhost on June 06, 2005, 05:08:11 AM

Title: newbie question ( decimal to float )
Post by: RedGhost on June 06, 2005, 05:08:11 AM
hello, i have a decimal say 45, and i want to convert that to 45.0f for a parameter, but i am lost on how to, i've really done no work with floats in masm, in c you could do a quick typecast (float)#

- thanks in advance
Title: Re: newbie question ( decimal to float )
Post by: Mirno on June 06, 2005, 09:56:18 AM
Look up the "fild" instruction, it loads an integer from memory, and pushes it onto the FPU register stack.

Mirno
Title: Re: newbie question ( decimal to float )
Post by: raymond on June 06, 2005, 02:23:40 PM
Then you can store it into a REAL4, REAL8 or REAL10 memory variable with:

fstp mem_var

If you want more info on the use of the FPU, you may want to take a look at:

http://www.ray.masmcode.com/index.html#fputut

Raymond
Title: Re: newbie question ( decimal to float )
Post by: RedGhost on June 07, 2005, 12:04:18 PM
Quote
http://www.ray.masmcode.com/index.html#fputut
Quote

awesome, i will give them a read

thank you both