04.01.2015 Views

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

CR1000 Manual - Campbell Scientific

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.

Section 10. Troubleshooting<br />

10.3.4.2 Floating-Point Math, NAN, and ±INF<br />

10.3.4.3 Data Types, NAN, and ±INF<br />

Table Math Expressions and CRBasic Results (p. 429) lists math expressions, their<br />

CRBasic form, and IEEE floating point-math result loaded into variables declared<br />

as FLOAT or STRING.<br />

NAN and ±INF are presented differently depending on the declared-variable data<br />

type. Further, they are recorded differently depending on the final-storage data<br />

type chosen compounded with the declared-variable data type used as the source<br />

(table Variable and FS Data Types with NAN and ±INF (p. 429) ). For example, INF<br />

in a variable declared As LONG is represented by the integer -2147483648.<br />

When that variable is used as the source, the final-storage word when sampled as<br />

UINT2 is stored as 0.<br />

Table 111. Math Expressions and CRBasic<br />

Results<br />

Expression<br />

CRBasic<br />

Expression<br />

Result<br />

0 / 0 0 / 0 NAN<br />

∞ - ∞ (1 / 0) - (1 / 0) NAN<br />

(-1) ∞ -1 ^ (1 / 0) NAN<br />

0 * -∞ 0 * (-1 * (1 / 0)) NAN<br />

±∞ / ±∞ (1 / 0) / (1 / 0) NAN<br />

1 ∞ 1 ^ (1 / 0) NAN<br />

0 * ∞ 0 * (1 / 0) NAN<br />

x / 0 1 / 0 INF<br />

x / -0 1 / -0 INF<br />

-x / 0 -1 / 0 -INF<br />

-x / -0 -1 / -0 -INF<br />

∞ 0 (1 / 0) ^ 0 INF<br />

0 ∞ 0 ^ (1 / 0) 0<br />

0 0 0 ^ 0 1<br />

Table 112. Variable and FS Data Types with NAN and ±INF<br />

Variable<br />

Type<br />

Test<br />

Expressio<br />

n<br />

Final-Storage Data Type & Associated Stored Values<br />

Public / Dim<br />

Variables FP2 IEEE4 UINT2 UNIT4 STRING BOOL BOOL8 LONG<br />

As FLOAT 1 / 0 INF INF1 INF1 655352 4294967295 +INF TRUE TRUE 2,147,483,647<br />

0 / 0 NAN NAN NAN 0 2147483648 NAN TRUE TRUE -2,147,483,648<br />

As LONG 1 / 0 2,147,483,647 7999 2.147484E09 65535 2147483647 2147483647 TRUE TRUE 2,147,483,647<br />

429

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

Saved successfully!

Ooh no, something went wrong!