That's why I said to use LONG variable types in post #2.
Code:
Include "modedefs.bas"
define OSC 20
define LOADER_USED 1 ' bootloader
RPM VAR WORD : STRAIN VAR WORD : TORQUE VAR WORD : A VAR WORD : C VAR LONG
A = 5252 : RPM = 8000
STRAIN = 35 : TORQUE = 300 : C = A * RPM * STRAIN * TORQUE
SEROUT PORTC.5,N2400,[12,".",#C," HP ",10,13,14]
END
Even that might overflow a 31bit signed variable.
A fits in 13 bits
RPM might take up to 14 bits
Strain (in your example) another 6 bits
Torque (in your example) another 9 bits
Multiply those all together and you could get a 42 bit answer.
What do you suppose your MAXimum values would be for each variable?
Bookmarks