Contenu principal

Types numériques

Nombres entiers et données à virgule flottante

Dans MATLAB®, les classes numériques comprennent les entiers signés et non signés ainsi que les nombres à virgule flottante simple et double précision. Par défaut, MATLAB stocke toutes les valeurs numériques sous forme de valeurs à virgule flottante double précision. (Il est impossible de modifier le type et la précision par défaut.) Vous pouvez choisir de stocker n’importe quel nombre ou tableau de nombres sous forme d’entiers ou de valeurs à simple précision. Les tableaux d’entiers et de valeurs simple précision permettent un stockage moins gourmand en mémoire que les valeurs double précision.

Tous les types numériques supportent les opérations de base sur les tableaux telles que l’indexation, le redimensionnement et les opérations mathématiques.

Fonctions

développer tout

doubleTableaux en double précision
singleTableaux en simple précision
int88-bit signed integer arrays
int1616-bit signed integer arrays
int3232-bit signed integer arrays
int6464-bit signed integer arrays
uint8Tableaux de nombres entiers non signés de 8 bits
uint1616-bit unsigned integer arrays
uint3232-bit unsigned integer arrays
uint6464-bit unsigned integer arrays
castConvert variable to different data type
typecastConvert data type without changing underlying data
allfiniteDetermine if all array elements are finite (depuis R2022a)
anynanDetermine if any array element is NaN (depuis R2022a)
isintegerDetermine whether input is integer array
isfloatDetermine if input is floating-point array
isnumericDetermine whether input is numeric array
isrealDetermine whether array uses complex storage
isfiniteDetermine which array elements are finite
isinfDetermine which array elements are infinite
isnanDéterminer les éléments NaN d'un tableau
epsFloating-point relative accuracy
flintmaxLargest consecutive integer in floating-point format
InfCreate array of all Inf values
intmaxLargest value of specific integer type
intminSmallest value of specific integer type
NaNCreate array of all NaN values
realmaxLargest positive floating-point number
realminSmallest normalized floating-point number

Rubriques

  • Floating-Point Numbers

    MATLAB represents floating-point numbers in either double-precision or single-precision format. The default is double precision.

  • Single Precision Math

    This example shows how to perform arithmetic and linear algebra with single precision data.

  • Nombres entiers

    MATLAB supporte le stockage des données entières sur 1, 2, 4 et 8 octets. En utilisant le plus petit type entier pouvant contenir vos données, vous pouvez économiser de la mémoire et réduire le temps d’exécution du programme.

  • Integer Arithmetic

    This example shows how to perform arithmetic on integer data representing signals and images.

  • Create Complex Numbers

    Create complex numbers. Complex numbers consist of a real part and an imaginary part.

  • Infinity and NaN

    MATLAB represents infinity by the special value inf, and values that are neither real nor complex by the special value NaN, which stands for “Not a Number”.

  • Identifying Numeric Classes

    You can check the data type of a variable using any of these commands.

  • Afficher le format des valeurs numériques

    Utilisez la fonction format ou définissez les paramètres pour contrôler l’affichage des valeurs numériques.

  • Combining Unlike Integer Types

    If you combine different integer types in a matrix (e.g., signed with unsigned, or 8-bit integers with 16-bit integers), all elements of the resulting matrix are given the data type of the leftmost element.

  • Combining Integer and Noninteger Data

    If you combine integers with double, single, or logical classes, all elements of the resulting matrix are given the data type of the leftmost integer.

  • Matrices vides

    Si vous créez une matrice avec des éléments de matrice vides, les matrices vides sont ignorées dans la matrice qui en résulte.

  • Concatenation Examples

    These examples show how to concatenate different data types.

  • Hexadecimal and Binary Values

    Specify hexadecimal and binary values either as literals or as text. Hexadecimal and binary literals are stored as integers. You can convert text representing hexadecimal and binary values to numbers, and numbers to text representations.

Ressources pédagogiques