SPLatco Knowledge Base

(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

WXR
0 <= W < 256Integer part of W0
-256 < W < 0Integer part of -W1
256 <= W <= +Inf2552
-Inf <= W <= -2562553
NaN04

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