I m trying to find how to make a division in ARM since there is no DIV
command. If that can be done by multiplication of a float number [/9 = *0.09]
, by subtraction or by the use of a library. Any way would do.
Currently I am doing division using subtraction using a loop like this but I loose the decimals:
MOV R0,#70 ;Fahrenheit Temperature
SUB R1,R0,#32 ; Subtracting 32
MOV R4,#0 ;Counter
LOOP
ADD R4,R4,#1; Counter+1 ->Is the answer of the division without decimals
SUB R1,#9
CMP R1,#0
BPL LOOP
MOV R1,R4
So basically what I am doing is that I have temperature 70, I subtract 32 and I get 38. Then in the loop I take 9 each time till the reminder is smaller than 9. The answer using normal division is 4.22222. Here I get 5. So my result is not as accurate.