octave: Integer Data Types

 
 4.4 Integer Data Types
 ======================
 
 Octave supports integer matrices as an alternative to using double
 precision.  It is possible to use both signed and unsigned integers
 represented by 8, 16, 32, or 64 bits.  It should be noted that most
 computations require floating point data, meaning that integers will
 often change type when involved in numeric computations.  For this
 reason integers are most often used to store data, and not for
 calculations.
 
    In general most integer matrices are created by casting existing
 matrices to integers.  The following example shows how to cast a matrix
 into 32 bit integers.
 
      float = rand (2, 2)
           ⇒ float = 0.37569   0.92982
                      0.11962   0.50876
      integer = int32 (float)
           ⇒ integer = 0  1
                        0  1
 
 As can be seen, floating point values are rounded to the nearest integer
 when converted.
 
  -- : isinteger (X)
      Return true if X is an integer object (int8, uint8, int16, etc.).
 
      Note that ‘isinteger (14)’ is false because numeric constants in
      Octave are double precision floating point values.
 
      See also: Seeisfloat XREFisfloat, Seeischar XREFischar,
      Seeislogical XREFislogical, Seeisnumeric XREFisnumeric,
      Seeisa XREFisa.
 
  -- : int8 (X)
      Convert X to 8-bit integer type.
 
DONTPRINTYET       See also: Seeuint8 XREFuint8, Seeint16 XREFint16, *noteDONTPRINTYET DONTPRINTYET       See also: Seeuint8 XREFuint8, Seeint16 XREFint16, See
      uint16 XREFuint16, Seeint32 XREFint32, *noteuint32:
DONTPRINTYET DONTPRINTYET       See also: Seeuint8 XREFuint8, Seeint16 XREFint16, See
      uint16 XREFuint16, Seeint32 XREFint32, Seeuint32

      XREFuint32, Seeint64 XREFint64, Seeuint64 XREFuint64.
 
  -- : uint8 (X)
      Convert X to unsigned 8-bit integer type.
 
DONTPRINTYET       See also: Seeint8 XREFint8, Seeint16 XREFint16, *noteDONTPRINTYET DONTPRINTYET       See also: Seeint8 XREFint8, Seeint16 XREFint16, See
      uint16 XREFuint16, Seeint32 XREFint32, *noteuint32:
DONTPRINTYET DONTPRINTYET       See also: Seeint8 XREFint8, Seeint16 XREFint16, See
      uint16 XREFuint16, Seeint32 XREFint32, Seeuint32

      XREFuint32, Seeint64 XREFint64, Seeuint64 XREFuint64.
 
  -- : int16 (X)
      Convert X to 16-bit integer type.
 
DONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, *noteDONTPRINTYET DONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, See
      uint16 XREFuint16, Seeint32 XREFint32, *noteuint32:
DONTPRINTYET DONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, See
      uint16 XREFuint16, Seeint32 XREFint32, Seeuint32

      XREFuint32, Seeint64 XREFint64, Seeuint64 XREFuint64.
 
  -- : uint16 (X)
      Convert X to unsigned 16-bit integer type.
 
DONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, *noteDONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, See
      int16 XREFint16, Seeint32 XREFint32, Seeuint32 XREFuint32,
      Seeint64 XREFint64, Seeuint64 XREFuint64.
 
  -- : int32 (X)
      Convert X to 32-bit integer type.
 
DONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, *noteDONTPRINTYET DONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, See
      int16 XREFint16, Seeuint16 XREFuint16, *noteuint32:
DONTPRINTYET DONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, See
      int16 XREFint16, Seeuint16 XREFuint16, Seeuint32

      XREFuint32, Seeint64 XREFint64, Seeuint64 XREFuint64.
 
  -- : uint32 (X)
      Convert X to unsigned 32-bit integer type.
 
DONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, *noteDONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, See
      int16 XREFint16, Seeuint16 XREFuint16, Seeint32 XREFint32,
      Seeint64 XREFint64, Seeuint64 XREFuint64.
 
  -- : int64 (X)
      Convert X to 64-bit integer type.
 
DONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, *noteDONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, See
      int16 XREFint16, Seeuint16 XREFuint16, Seeint32 XREFint32,
      Seeuint32 XREFuint32, Seeuint64 XREFuint64.
 
  -- : uint64 (X)
      Convert X to unsigned 64-bit integer type.
 
DONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, *noteDONTPRINTYET       See also: Seeint8 XREFint8, Seeuint8 XREFuint8, See
      int16 XREFint16, Seeuint16 XREFuint16, Seeint32 XREFint32,
      Seeuint32 XREFuint32, Seeint64 XREFint64.
 
  -- : intmax (TYPE)
      Return the largest integer that can be represented in an integer
      type.
 
      The variable TYPE can be
 
      ‘int8’
           signed 8-bit integer.
 
      ‘int16’
           signed 16-bit integer.
 
      ‘int32’
           signed 32-bit integer.
 
      ‘int64’
           signed 64-bit integer.
 
      ‘uint8’
           unsigned 8-bit integer.
 
      ‘uint16’
           unsigned 16-bit integer.
 
      ‘uint32’
           unsigned 32-bit integer.
 
      ‘uint64’
           unsigned 64-bit integer.
 
      The default for TYPE is ‘int32’.
 
      See also: Seeintmin XREFintmin, Seeflintmax XREFflintmax.
 
  -- : intmin (TYPE)
      Return the smallest integer that can be represented in an integer
      type.
 
      The variable TYPE can be
 
      ‘int8’
           signed 8-bit integer.
 
      ‘int16’
           signed 16-bit integer.
 
      ‘int32’
           signed 32-bit integer.
 
      ‘int64’
           signed 64-bit integer.
 
      ‘uint8’
           unsigned 8-bit integer.
 
      ‘uint16’
           unsigned 16-bit integer.
 
      ‘uint32’
           unsigned 32-bit integer.
 
      ‘uint64’
           unsigned 64-bit integer.
 
      The default for TYPE is ‘int32’.
 
      See also: Seeintmax XREFintmax, Seeflintmax XREFflintmax.
 
  -- : flintmax ()
  -- : flintmax ("double")
  -- : flintmax ("single")
      Return the largest integer that can be represented consecutively in
      a floating point value.
 
      The default class is "double", but "single" is a valid option.  On
      IEEE 754 compatible systems, ‘flintmax’ is 2^{53} for "double" and
      2^{24} for "single".
 
      See also: Seeintmax XREFintmax, Seerealmax XREFrealmax,
      Seerealmin XREFrealmin.
 

Menu