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


mtlb_uint32

Matlab uint32 emulation function

Description

Matlab and Scilab uint32 behave differently :

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

Let imax = 2^32 - 1 = 4294967295.

xuint32(x)mtlb_uint32(x)
%nan00
-%inf00
-2imax-10
-1imax0
000
111
10.21010
10.51011
10.511011
.........
imaximaximax
imax+10imax
imax+11imax
%infimaximax

mtlb_uint32 has not to be used for hand coded functions.

The function mtlb_uint32(A) is used by mfile2sci to replace uint32(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_uint16 compatibility_functions mtlb_uint64 >>

Copyright (c) 2022-2024 (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 May 22 12:41:19 CEST 2023