Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes


mtlb_uint16

Matlab uint16 emulation function

Description

Matlab and Scilab uint16 behave differently :

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

xuint16(x)mtlb_uint16(x)
%nan00
-%inf00
-2655340
-1655350
000
222
10.21010
10.51011
10.511011
.........
655356553565535
65536065535
65537165535
%inf6553565535

mtlb_uint16 has not to be used for hand coded functions.

The function mtlb_uint16(A) is used by mfile2sci to replace uint16(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_true Compatible fonctions mtlb_uint32 >>

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:
Mon Nov 07 15:06:11 CET 2022