Matlab uint64 emulation function
Matlab and Scilab uint64
behave differently :
uint64()
wraps,
while Matlab's mtlb_uint64()
saturates.uint64()
truncates the
fractional part, while Matlab's mtlb_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 |