mtlb_int64
Matlab int64 emulation function
Description
Matlab and Scilab int64
behave differently :
- Beyong the main interval bounds, Scilab's
int64()
wraps, while Matlab'smtlb_int64()
saturates. - For non integer values, Scilab's
int64()
truncates the fractional part, while Matlab'smtlb_int64()
rounds to the nearest integer.
Let imin = -(2^32) = -9223372036854775808
and
imax = 2^32 - 1 = 9223372036854775807
.
x | int64(x) | mtlb_int64(x) |
---|---|---|
%nan | 0 | 0 |
-%inf | imin | imin |
imin-2 | imax-1 | imin |
imin-1 | imax | imin |
imin | imin | imin |
-80.7 | -80 | -81 |
-80.5 | -80 | -81 |
-80.4 | -80 | -80 |
10.2 | 10 | 10 |
10.5 | 10 | 11 |
10.51 | 10 | 11 |
imax | imax | imax |
imax+1 | imin | imax |
imax+2 | imin+1 | imax |
imax+3 | imin+2 | imax |
%inf | imax | imax |
The function |
Report an issue | ||
<< mtlb_int32 | Compatible fonctions | mtlb_int8 >> |