std::ceil
cppreference.com
[] |
Google. . , . , . |
<metanoindex/>
<tbody> </tbody> float ceil( float arg ); |
||
double ceil( double arg ); |
||
long double ceil( long double arg ); |
||
double ceil( Integral arg ); |
( C++11) | |
arg. | arg |
,
arg[[Image: |200x200px]]
Argument
( ) ( ), , .
:
If the argument is infinity (positive or negative) or zero (positive or negative), the return value is the same as the argument.
, .
:
The largest representable floating-point values are exact integers in all standard floating-point formats, so this function never overflows.
, , FE_INEXACT .
:
This function may, but is not required to, raise FE_INEXACT floating-point exceptions for non-integer arguments.
#include <cmath>
#include <iostream>
int main()
{
double a = 12.0;
std::cout << std::fixed;
std::cout << std::ceil(12.0) << '\n';
std::cout << std::ceil(12.1) << '\n';
std::cout << std::ceil(12.5) << '\n';
std::cout << std::ceil(12.9) << '\n';
std::cout << std::ceil(13.0) << '\n';}
:
12.000000
13.000000
13.000000
13.000000
13.000000
.
(C++11)(C++11) |
() |
(C++11)(C++11)(C++11) |
, () |
(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11) |
, () |
(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11)(C++11) |
, () |
(C++11)(C++11)(C++11) |
() |