Shifting numbers in MMBasic


Author Message
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 04:29am 08 Mar 2012      

and you can toss away a lot of the parentheses as exponentiation has the highest priority in processing. I just checked the manual. So byte1*(2^16) can become byte1*2^16 and it will process correctly.

A further thought: there is a maximum number that you can process before you lose accuracy. A quote from page 8 of the reverence manual:
The range of integers (whole numbers) that can be manipulated without loss of accuracy is ±16777100


This is just short of 256*2^16 which is 0xFFFF8C. It's an odd figure. Anyway, with your calculation you could easily exceed that figure.Edited by BobD 2012-03-09