09.12.2012 Views

Basic Characteristics RAPID

Basic Characteristics RAPID

Basic Characteristics RAPID

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.

num Numeric values (registers)<br />

Description<br />

Example<br />

Num is used for numeric values; e.g. counters.<br />

The value of the num data type may be<br />

- an integer; e.g. -5,<br />

- a decimal number; e.g. 3.45.<br />

It may also be written exponentially; e.g.2E3 (= 2*10 3 = 2000), 2.5E-2 (= 0.025).<br />

Integers between -8388607 and +8388608 are always stored as exact integers.<br />

Decimal numbers are only approximate numbers and should not, therefore, be used in<br />

is equal to or is not equal to comparisons. In the case of divisions, and operations using<br />

decimal numbers, the result will also be a decimal number; i.e. not an exact integer.<br />

E.g. a := 10;<br />

b := 5;<br />

IF a/b=2 THEN As the result of a/b is not an integer,<br />

this condition is not necessarily<br />

... satisfied.<br />

VAR num reg1;<br />

.<br />

reg1 := 3;<br />

Predefined data<br />

reg1 is assigned the value 3.<br />

a := 10 DIV 3;<br />

b := 10 MOD 3;<br />

Integer division where a is assigned an integer (=3) and b is assigned the<br />

remainder (=1).<br />

The constant pi (π) is already defined in the system module BASE.<br />

CONST num pi := 3.1415926;<br />

<strong>RAPID</strong> Reference Manual 7-num-1

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

Saved successfully!

Ooh no, something went wrong!