en fr

Sysquake Pro – Table of Contents

Sysquake – Table of Contents

Sysquake for LaTeX – Table of Contents

Integer Functions

uint8 uint16 uint32 uint64 int8 int16 int32 int64

Conversion to integer types.

Syntax

B = uint8(A)
B = uint16(A)
B = uint32(A)
B = uint64(A)
B = int8(A)
B = int16(A)
B = int32(A)
B = int64(A)

Description

The functions convert a number or an array to unsigned or signed integers. The name contains the size of the integer in bits.

To avoid a conversion from double to integer, constant literal numbers should be written with a type suffix, such as 12int32. This is the only way to specify large 64-bit numbers, because double-precision floating-point numbers have a mantissa of 56 bits.

Constant arrays of uint8 can also be encoded in a compact way using base64 inline data.

uint64 and int64 are not supported on platforms with tight memory constraints.

Examples

uint8(3)
  3uint8
3uint8
  3uint8
uint8([50:50:400])
  1x8 uint8 array
    50 100 150 200 250  44  94 144
@/base64 MmSWyPosXpA=
   50
  100
  ...
  144
int8([50:50:400])
  1x8 int8 array
    50  100 -106  -56   -6   44   94 -112

The base64 data above is obtained with the following expression:

base64encode(uint8([50:50:400]))

See also

double, single, char, logical, map2int

intmax

Largest integer.

Syntax

i = intmax
i = intmax(type)

Description

Without input argument, intmax gives the largest signed 32-bit integer. intmax(type) gives the largest integer of the type specified by string type, which can be 'uint8', 'uint16', 'uint32', 'uint64', 'int8', 'int16', 'int32', or 'int64' (64-bit integers are not supported on all platforms). The result has the corresponding integer type.

Examples

intmax
  2147483647int32
intmax('uint16')
  65535uint16

See also

intmin, realmax, flintmax, uint8 and related functions, map2int

intmin

Smallest integer.

Syntax

i = intmin
i = intmin(type)

Description

Without input argument, intmin gives the smallest signed 32-bit integer. intmin(type) gives the largest integer of the type specified by string type, which can be 'uint8', 'uint16', 'uint32', 'uint64', 'int8', 'int16', 'int32', or 'int64' (64-bit integers are not supported on all platforms). The result has the corresponding integer type.

Examples

intmin
  -2147483648int32
intmin('uint16')
  0uint16

See also

intmax, realmin, uint8 and related functions, map2int

map2int

Mapping of a real interval to an integer type.

Syntax

B = map2int(A)
B = map2int(A, vmin, vmax)
B = map2int(A, vmin, vmax, type)

Description

map2int(A,vmin,vmax) converts number or array A to 8-bit unsigned integers. Values between vmin and vmax in A are mapped linearly to values 0 to 255. With a single input argument, the default input interval is 0 to 1.

map2int(A,vmin,vmax,type) converts A to the specified type, which can be any integer type given as a string: 'uint8', 'uint16', 'uint32', 'uint64', 'int8', 'int16', 'int32', or 'int64' (64-bit integers are not supported on all platforms). The input interval is mapped to its full range.

In all cases, input values outside the interval are clipped to the minimum or maximum values.

Examples

map2int(-0.2:0.2:1.2)
  1x5 uint8 array
    0   0  51 102 153 204 255 255
map2int([1,3,7], 0, 10, 'uint16')
  1x3 uint16 array
    6553 19660 45875
map2int([1,3,7], 0, 10, 'int16')
  1x3 int16 array
    -26214 -13107  13107

See also

uint8 and related functions.