mtlb_int8
Matlab int8 emulation function
Description
Matlab and Scilab int8
behave differently :
- Beyong the main interval bounds, Scilab's
int8()
wraps, while Matlab'smtlb_int8()
saturates. - For non integer values, Scilab's
int8()
truncates the fractional part, while Matlab'smtlb_int8()
rounds to the nearest integer.
x | int8(x) | mtlb_int8(x) |
---|---|---|
%nan | 0 | 0 |
-%inf | -128 | -128 |
-130 | 126 | -128 |
-129 | 127 | -128 |
-128 | -128 | -128 |
-127 | -127 | -127 |
-80.7 | -80 | -81 |
-80.5 | -80 | -81 |
-80.4 | -80 | -80 |
10.2 | 10 | 10 |
10.5 | 10 | 11 |
10.51 | 10 | 11 |
127 | 127 | 127 |
128 | -128 | 127 |
129 | -127 | 127 |
%inf | 127 | 127 |
The function |
Report an issue | ||
<< mtlb_int64 | compatibility_functions | mtlb_is >> |