14.01.2015 Views

Gemini GV6K and Gemini GT6K Programmer's Guide

Gemini GV6K and Gemini GT6K Programmer's Guide

Gemini GV6K and Gemini GT6K Programmer's Guide

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.

Using Numeric (VAR <strong>and</strong> VARI) Variables<br />

NOTES<br />

• The examples below show the use of real numeric variables (VAR). Integer variables may<br />

be used in the same operations with these exceptions:<br />

- Values are truncated to nearest integer value<br />

- Operations using square root (SQRT) <strong>and</strong> trigonometric (ATAN, COS, PI, SIN, TAN)<br />

operators are not allowed<br />

• Some numeric variable operations reduce precision. The following operations reduce the<br />

precision of the return value: Division <strong>and</strong> Trigonometric functions yield 5 decimal places;<br />

Square Root yields 3 decimal places; <strong>and</strong> Inverse Trigonometric functions yield 2 decimal<br />

places.<br />

Mathematical<br />

Operations<br />

The following examples demonstrate how to perform math operations with numeric variables.<br />

Operator precedence occurs from left to right (e.g., VAR1=1+1+1∗3 sets VAR1 to 9, not 5).<br />

Addition (+) Example Response<br />

VAR1=5+5+5+5+5+5+5<br />

VAR1<br />

*VAR1=35.0<br />

VAR23=1000.565<br />

VAR11=VAR1+VAR23<br />

VAR11<br />

*VAR11=+1035.565<br />

VAR1=VAR1+5<br />

VAR1<br />

*VAR1=+40.0<br />

Subtraction (-) Example Response<br />

VAR3=20-10<br />

VAR20=15.5<br />

VAR3=VAR3-VAR20<br />

VAR3<br />

*VAR3=-5.5<br />

Multiplication (*) Example Response<br />

VAR3=10<br />

VAR3=VAR3*20<br />

VAR3<br />

*VAR3=+200.0<br />

Division (/) Example Response<br />

VAR3=10<br />

VAR20=15.5<br />

VAR20 *+15.5<br />

VAR3=VAR3/VAR20<br />

VAR3 *+0.64516<br />

VAR30=75<br />

VAR30 *+75.0<br />

VAR19=VAR30/VAR3<br />

VAR19 *+116.25023<br />

Square Root (SQRT) Example Response<br />

VAR3=75<br />

VAR20=25<br />

VAR3=SQRT(VAR3)<br />

VAR3 *+8.660<br />

VAR20=SQRT(VAR20)+SQRT(9)<br />

VAR20 *+8.0<br />

Chapter 1. Programming Fundamentals 19

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

Saved successfully!

Ooh no, something went wrong!