I am having a bad time understanding some FPU coding.
Could someone pleeeese help.
The project is a simple temperature conversion program.


.elseif uMsg == WM_COMMAND
.if wParam == 1000 ;calculate button

finit
FltIn addr R8t, 100 ;hEdit1
fld R8t
FltIn addr R8t, 101
fld R8t
fsub
fstp R8t
FltOut R8t, 102

The above does straight adding.
How would I code..The value of ((hEdit1-32)*5)/9
I use 2 edit boxes, one for input (100) and 1 for the answer (102)
Thanks
Bob. :confused:
Posted on 2002-05-25 11:16:55 by BobMcK
; ((hEdit1-32)*5)/9
push 32
fld hEdit1
fisub DWORD PTR
push 5
fimul DWORD PTR
push 9
fidiv DWORD PTR
fstp hEdit1
add esp,4*3

this might work? those Intel manuals aren't evil.
and with my fpc macro...

; ((hEdit1-32)*5)/9
fld hEdit1
fsub fpc(32)
fmul fpc(0.55555555555555555555555555555556)
fstp hEdit1
Posted on 2002-05-25 11:36:12 by bitRAKE
Sorry about that bitRAKE.
I found your old post after I posted this one.
I had to make a couple of changes.


finit
push 32
FltIn addr R8t, 100
fld R8t
fisub DWORD PTR [esp]
push 5
fimul DWORD PTR [esp]
push 9
fidiv DWORD PTR [esp]
fstp R8t
add esp,4*3
FltOut R8t, 101


In the May 25th post.
Thanks for all your help bitRAKE.
Bob.
Posted on 2002-06-15 12:49:36 by BobMcK
hmmm... bitRAKE has been of a great help to me (thanks!) and i see i'm not the only Canuck getting help from him =)

just assign hEdit1 the value of "it's cold!" if you're trying to convert farenheit in the Great White North to Celsius :)
Posted on 2002-06-15 22:59:27 by jademtech