fix
(T=Z; Z=Y; Y=X;) X = (int)W; R = <return code>
(Convert from Floating Point to fixed point (integer))
Converts the number in floating point register W to an integer nn, Pushes the integer result to X and sets a Return Code in R.
The resulting number in X, and the result code in R, depend on the number in W
W | X | R |
0 <= W < 256 | Integer part of W | 0 |
-256 < W < 0 | Integer part of -W | 1 |
256 <= W <= +Inf | 255 | 2 |
-Inf <= W <= -256 | 255 | 3 |
NaN | 0 | 4 |
Note that in the normal range 0 to 255 (and down to -255), the fix instruction truncates the argument. Thus 13.999 (and -13.999) gives the result 13.
Dialect restriction: The fix instruction is not implemented in boards with dialect numbers less than 6, or which do not have the FP processor.
See also float