Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - Русский

Change language to:
English - Français - 日本語 - Português -

Please note that the recommended version of Scilab is 2023.1.0. This page might be outdated.
See the recommended documentation of this function

Справка Scilab >> Code Matlab => Scilab > Compatible fonctions > mtlb_int64

mtlb_int64

Matlab int64 emulation function

Description

Matlab and Scilab int64 behave differently :

  • Beyong the main interval bounds, Scilab's int64() wraps, while Matlab's mtlb_int64() saturates.
  • For non integer values, Scilab's int64() truncates the fractional part, while Matlab's mtlb_int64() rounds to the nearest integer.

Let imin = -(2^32) = -9223372036854775808 and imax = 2^32 - 1 = 9223372036854775807.

xint64(x)mtlb_int64(x)
%nan00
-%infiminimin
imin-2imax-1imin
imin-1imaximin
iminiminimin
-80.7-80-81
-80.5-80-81
-80.4-80-80
10.21010
10.51011
10.511011
imaximaximax
imax+1iminimax
imax+2imin+1imax
imax+3imin+2imax
%infimaximax

mtlb_int64 has not to be used for hand coded functions.

The function mtlb_int64(A) is used by mfile2sci to replace int64(A) when it is not possible to know what is the input while porting Matlab code to Scilab. This function then determines the correct semantic at run time.

Report an issue
<< mtlb_int32 Compatible fonctions mtlb_int8 >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:55:07 CET 2020