Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - Русский
Scilabヘルプ >> Compatibility Functions > mtlb_int8

mtlb_int8

Matlab int8 emulation function

Description

Matlab and Scilab int8 behave differently :

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

xint8(x)mtlb_int8(x)
%nan00
-%inf-128-128
-130126-128
-129127-128
-128-128-128
-127-127-127
-80.7-80-81
-80.5-80-81
-80.4-80-80
10.21010
10.51011
10.511011
127127127
128-128127
129-127127
%inf127127

mtlb_int8 has not to be used for hand coded functions.

The function mtlb_int8(A) is used by mfile2sci to replace int8(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.

Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Feb 14 15:02:37 CET 2019