mtlb_uint64
Matlab uint64 emulation function
Description
Matlab and Scilab uint64 behave differently :
- Beyong the main interval bounds, Scilab's
uint64()wraps, while Matlab'smtlb_uint64()saturates. - For non integer values, Scilab's
uint64()truncates the fractional part, while Matlab'smtlb_uint64()rounds to the nearest integer.
Let imax = 2^64 - 1 = 18 446 744 073 709 551 615.
| x | uint64(x) | mtlb_uint64(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_uint32 | Compatible fonctions | mtlb_uint8 >> |
