Previous Topic: Real Number Arithmetic

Next Topic: Comparisons With Real Numbers

&CONTROL REAL

NCL always uses real number arithmetic if the &CONTROL REAL operand is in effect. This means that even if an operation contains only integers, real number arithmetic is used and the result is placed in the target variable in scientific notation form. It also means that calculations are performed accurately, so that whereas, in the example of integer arithmetic given earlier, the result of dividing 10 by 4 is given as 2, with real arithmetic the answer would be the precise answer of 2.5 but expressed in the result variable as:

+.250000000000000E+01

If you do not code &CONTROL REAL (which means that the default &CONTROL INTEGER is in force), NCL automatically performs real number arithmetic if real numbers are present in any arithmetic expressions. This automatic switch to real number mode is transparent to your arithmetic functions but is of significance if you want to perform comparison operations where real numbers are involved.