Microchip Floating Point Routines
I'm attempting to use the Microchip 32 bit floating point routines per the application note on the Melabs web site:
aint = 200
Gosub itofa ' Convert int to float
bint = 3
Gosub itofb ' Convert int to float
Gosub fpmul '
bint = 100
Gosub itofb ' Convert int to float
Gosub fpmul ' Multiply by 100 to move remainder up 2 places
Gosub ftoia ' Convert float to int
aint = aint // 100 ' Get to the remainder
hserout [".", dec2 aint]
When I put in 200 and 3 for aint and bint respectively, the routine returns a result of 600 and a remainder of 0 as expected.
However, if I put in 200 and 30 respectively, the routine returns 6000 and a remainder of 76. I'm having similar problems with division.
Can anyone help me with this?
Joe