Manual

Math Package for
W
INTERPRET
(T
7
833)
PD
- 7
043
March, 06
11
A = SQRT (B)
During execution in the Regent, the value of B may change
from one scan cycle to the next. Table
6
illustrates the values
of B the result stored in A for a series of scan cycles to
illustrate the effects of a math error (square root of a negative
number).
Table
6
. Example of Math Error and Result Values.
Scan
B
SQRT(B)
Result, A
1
25
5
5
2
16
4
4
3
2
1.414213
1.414213
4
-
7
<error>
1.414213
5
1
1
1
During scan 4, the
square root of
-
7 produces an error, and the
result, A, retains its last valid value (1.414213). In scan 5, the
square root of 1 is valid so the result, A, is updated with the
new value square root of 1 = 1.
User
-
Supplied Error Handling Logic
Each floating point math function block contains two registers
in which error codes are placed by the Regent during
execution. Error codes indicate what type of error occurred
and the line number on which it occurred. This error
information can be tested in the fun
ction block as desired.
Error Code Variable
The error code variable must be assigned a name. This name
will hold the error code. Four error codes are generated as
shown in Table
7
.