04.03.2013 Views

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SQR (Square Root)<br />

SQR returns the integer portion of the square root of the argument. Increased precision can be<br />

obtained by multiplying the argument by an even square of 10, such as 100 or 10000.<br />

Example 1<br />

If the value of “num” is 64, the following statement will return the value of 8 (which is the square root<br />

of 64).<br />

answer = sqr num<br />

Example 2<br />

If the value of “num” is 220, the following statement will return the value 14, which is the integer<br />

portion of 14.832..., the square root of 220.<br />

answer = sqr num<br />

Example 3<br />

If more precision is required, multiply the argument by 100 or 10000. Using the example where “num”<br />

= 220 a value 148 is returned, which is 10 times the square root of 220.<br />

answer = sqr (num * 100)<br />

Alternately,<br />

answer = sqr (num * 10000)<br />

the above example will return the value 1483, which is 100 times the square root of 220.<br />

Structure - Math<br />

50

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

Saved successfully!

Ooh no, something went wrong!