mtlb_uint16
Matlab uint16 emulation function
Description
Matlab and Scilab uint16 behave differently :
            
- Beyong the main interval bounds, Scilab's uint16()wraps, while Matlab'smtlb_uint16()saturates.
- For non integer values, Scilab's uint16()truncates the fractional part, while Matlab'smtlb_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  | 
| Report an issue | ||
| << mtlb_true | compatibility_functions | mtlb_uint32 >> |