04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Appendix A. CRBasic Programming Instructions<br />

A.6 Processing and Math Instructions<br />

A.6.1 Mathematical Operators<br />

Note Program declaration AngleDegrees() (see Program Declarations (p. 473) )<br />

sets math functions to use degrees instead of radians.<br />

A.6.2 Arithmetic Operators<br />

Table 116. Arithmetic Operators<br />

Symbol Name Notes<br />

^<br />

Raise to power<br />

Result is always promoted to a float (p. 142) to avoid problems that<br />

may occur when raising an integer to a negative power. However,<br />

loss of precision occurs if result is > 24 bits.<br />

For example:<br />

(46340 ^ 2) will yield 2,147,395,584 (not precisely correct)<br />

whereas,<br />

(46340 * 46340) will yield 2,147,395,600 (precisely correct)<br />

Simply use repeated multiplications instead of ^ operators when<br />

full 32-bit precision is required.<br />

Same functionality as PWR() (p. 497) instruction.<br />

* Multiply<br />

/ Divide Use INTDV() (p. 497) to retain 32-bit precision<br />

+ Add<br />

- Subtract<br />

= Equal to<br />

Not equal to<br />

> Greater than<br />

< Less than<br />

>=<br />

) allow the program to manipulate the positions<br />

of patterns of bits within an integer (CRBasic Long type). Here are some example<br />

expressions and the expected results:<br />

• &B00000001

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

Saved successfully!

Ooh no, something went wrong!