News:

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

floating point in masm

Started by darrenls59, November 11, 2007, 05:42:57 PM

Previous topic - Next topic

darrenls59

i need to divide/multiply by 1.8 in masm. Anyone know of a tried and tested method?

Thanks

TNick

:)

I just know a way for 2.7:

.DATA
Float1 REAL4   10.7
Floar2 REAL4 2.7
Float3 REAL4 1.0
.CODE
finit
fld Float1
fdiv Floar2
fstp Float3
FWAIT



Nick

PS Didn't tried and didn't tested. May be buggy!!! Use with extreme care! :)

Tedd

FPU is one option..

Sticking to integers:

a * 1.8 = a * 9 / 5
a / 1.8 = a * 5 / 9

Although, depending what your numbers are, you might find better numbers for binary ops, e.g. shifts, to avoid mul and div.
No snowflake in an avalanche feels responsible.