mtlb_uint32
Matlab uint32 emulation function
Description
Matlab and Scilab uint32 behave differently :
            
- Beyong the main interval bounds, Scilab's 
uint32()wraps, while Matlab'smtlb_uint32()saturates. - For non integer values, Scilab's 
uint32()truncates the fractional part, while Matlab'smtlb_uint32()rounds to the nearest integer. 
Let imax = 2^32 - 1 = 4294967295.
| x | uint32(x) | mtlb_uint32(x) | 
|---|---|---|
| %nan | 0 | 0 | 
| -%inf | 0 | 0 | 
| -2 | imax-1 | 0 | 
| -1 | imax | 0 | 
| 0 | 0 | 0 | 
| 1 | 1 | 1 | 
| 10.2 | 10 | 10 | 
| 10.5 | 10 | 11 | 
| 10.51 | 10 | 11 | 
| ... | ... | ... | 
| imax | imax | imax | 
| imax+1 | 0 | imax | 
| imax+1 | 1 | imax | 
| %inf | imax | imax | 
![]()  | 
 The function   | 
| Report an issue | ||
| << mtlb_uint16 | compatibility_functions | mtlb_uint64 >> | 
