mtlb_uint8
Matlab uint8 emulation function
Description
Matlab and Scilab uint8
behave differently :
- Beyong the main interval bounds, Scilab's
uint8()
wraps, while Matlab'smtlb_uint8()
saturates. - For non integer values, Scilab's
uint8()
truncates the fractional part, while Matlab'smtlb_uint8()
rounds to the nearest integer.
x | uint8(x) | mtlb_uint8(x) |
---|---|---|
%nan | 0 | 0 |
-%inf | 0 | 0 |
-2 | 254 | 0 |
-1 | 255 | 0 |
0 | 0 | 0 |
2 | 2 | 2 |
10.2 | 10 | 10 |
10.5 | 10 | 11 |
10.51 | 10 | 11 |
... | ... | ... |
255 | 255 | 255 |
256 | 0 | 255 |
257 | 1 | 255 |
%inf | 255 | 255 |
The function |
Report an issue | ||
<< mtlb_uint64 | Compatible fonctions | mtlb_upper >> |