News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Help with StrToFloat

Started by georgek01, September 07, 2006, 03:17:13 PM

Previous topic - Next topic

georgek01

Hello!

I need to convert two strings to floating point numbers, then compare them to get the lowest. The follwoing code doesn't work however...



szNum1 db '0.1457',0
szNum2 db '0.1568',0

...

fpNum1 QWORD ?
fpNum2 QWORD ?

...

invoke StrToFloat, addr szNum1, addr fpNum1
invoke StrToFloat, addr szNum2, addr fpNum2

.if fpNum1 > fpNum2 ; compiler doesn't like this

.else

.endif

...


You assistance will be greatly appreciated!!
What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)

mnemonic

Hi georgek01,

the comparison will not work that way.

You have to do that manually yourself via the FPU or you can use the FpuComp Function which comes in a library with the MASM32 package.
For details regarding FpuComp I suggest you have a look into \masm32\help\fpulib.hlp.

Regards
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

georgek01

Thanks mnemonic for the response.  :U

I'll have a look there.
What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)