04.03.2013 Views

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Math<br />

Structure - Math<br />

As with most BASIC implementations, M<strong>Basic</strong> includes a full complement of math and comparison<br />

functions. M<strong>Basic</strong> supports 32 bit integer math, both signed and unsigned. It also supports fl oating<br />

point math, signed or unsigned. A signed value denotes whether the resulting value is positive or<br />

negative.<br />

Floating point math can be processor intensive. This should be considered whenever making a<br />

decision in creating a program with math functions. There are numerous cases where fl oating<br />

point math is required. Hence, the fl exibility of the <strong>Basic</strong>ATOM when compared to other available<br />

processors.<br />

Number Bases<br />

Although all calculations are handled internally in binary, users can refer to numbers as decimal,<br />

hexadecimal or binary, whichever is most convenient for the programmer. For example, the number<br />

2349 can be referred to as:<br />

2349 Decimal<br />

0x092D Hexadecimal<br />

%100100101101 Binary<br />

Leading zeros are not required for hex or binary numbers, but may be used if desired. When using<br />

signed integers (sbyte, sword, slong) it is probably a good idea to stick to decimal notation to avoid<br />

confusion.<br />

Math and Operators<br />

Operators are what makes math work, by performing a function. An example of an operator would<br />

be + (Addition), - (Subtraction), * (Multiplication) and / (Division). All these symbols represent an<br />

operation to be performed. However, the operators need something to do, so we add operands which<br />

are better known as arguments. Math arguments are the values used in an expression.<br />

In the following section you will see the word “expression” used many times. This refers to something<br />

like 1+2. The expression 1+2 has one operator (+) and two arguments(1 and 2) or operands.<br />

44

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!