std::floor
De cppreference.com
<metanoindex/>
<tbody> </tbody>| Definido no cabeçalho <cmath>
|
||
float floor( float arg ); |
||
double floor( double arg ); |
||
long double floor( long double arg ); |
||
double floor( Integral arg ); |
(desde C++11) | |
Calcula inteiro mais próximo não superior a
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.
You can help to correct and verify the translation. Click here for instructions.
Parâmetros
| arg | - | flutuando valor de ponto
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. |
Valor de retorno
Mais próximo número inteiro não superior a
argOriginal:
Nearest integer not greater than
argThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[[Image:
Valor de retorno
|200x200px]]Original:
{{{2}}}
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Argument
Notas
O valor inteiro pode ser sempre representado pelo tipo de dado ponto flutuante.
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.
You can help to correct and verify the translation. Click here for instructions.
Exemplo
#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';
}
Saída:
12.000000
12.000000
12.000000
12.000000
13.000000
