◐ Shell
clean mode source ↗

std::floor — cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

Déclaré dans l'en-tête

<cmath>

float floor( float arg );

double floor( double arg );

long double floor( long double arg );

double floor( Integral arg );

(depuis C++11)

Calcule entier le plus proche ne dépassant pas arg .

Original:

Computes nearest integer not greater than arg.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Paramètres

arg -

valeur du point flottant

Original:

floating point value

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Retourne la valeur

Entier le plus proche ne dépassant pas arg

Original:

Nearest integer not greater than arg

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[[Image:

Retourne la valeur

Original:

{{{2}}}

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

|200x200px]]

Argument

Notes

La valeur entière peut toujours être représentée par le type virgule flottante donné .

Original:

The integer value can be always represented by the given floating point type.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Exemple

#include <cmath>
#include <iostream>
 
int main()
{
    std::cout << std::fixed;
    std::cout << std::floor(12.0) << '\n';
    std::cout << std::floor(12.1) << '\n';
    std::cout << std::floor(12.5) << '\n';
    std::cout << std::floor(12.9) << '\n';
    std::cout << std::floor(13.0) << '\n';
}

Résultat :

12.000000
12.000000
12.000000
12.000000
13.000000

Voir aussi

entier le plus proche n'est pas inférieure à la valeur donnée

Original:

nearest integer not less than the given value

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(fonction) [edit]

(C++11)

entier le plus proche n'est pas supérieure en grandeur à la valeur donnée

Original:

nearest integer not greater in magnitude than the given value

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(fonction) [edit]

(C++11)
(C++11)
(C++11)

entier le plus proche, arrondi en s'éloignant de zéro dans les cas de transition

Original:

nearest integer, rounding away from zero in halfway cases

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(fonction) [edit]