Matlab uint16 emulation function
Matlab and Scilab uint16
behave differently :
uint16()
wraps,
while Matlab's mtlb_uint16()
saturates.uint16()
truncates the
fractional part, while Matlab's mtlb_uint16()
rounds to the
nearest integer.x | uint16(x) | mtlb_uint16(x) |
---|---|---|
%nan | 0 | 0 |
-%inf | 0 | 0 |
-2 | 65534 | 0 |
-1 | 65535 | 0 |
0 | 0 | 0 |
2 | 2 | 2 |
10.2 | 10 | 10 |
10.5 | 10 | 11 |
10.51 | 10 | 11 |
... | ... | ... |
65535 | 65535 | 65535 |
65536 | 0 | 65535 |
65537 | 1 | 65535 |
%inf | 65535 | 65535 |
![]() |
The function |