Really dumb question
kq6f
Posts: 5
Am almost afraid to ask, but can the BS2 do fractional math. Suppose I want to divide two numbers and get the result to say 2 or 3 decimal places. How do I do it? All I can find in the manual are references to INTEGER math...
Comments
Check out http://www.emesystems.com/BS2index.htm... Tracy Allen has some great write ups about this very topic!
As in -- the value "2000" will actually represent "20.00". As long as you 'scale' numbers properly, this can work.
Now, one additional problem is the BS2 math currently maxes out with "Words" -- or 16-bit quantities. So you can have values from zero to 65535. If you assign two decimal places, that becomes zero to 655.35 -- so that can be limiting.
There ARE ways of doing 32-bit math -- but it's going to be slow, since you'll have to manipulate the low-Word and high-Word yourself in PBasic code.