[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/numeric/math/ceil [Back]  [Original]

std::ceil cppreference.com
cppreference.com

std::ceil

cppreference.com

<metanoindex/>

 
C++
(C++20)
(C++20)
(C++11)
(C++20)
/
(C++11)
(C++11)
(C++11)
(C++17)
 
(C++17)
(C++20)
(C++11)
(C++11)
(C++17)
(C++17)
(C++20)
(C++20)
(C++11)
(C++17)
(C++20)
(C++23)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
 
(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)
(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)
 
<tbody> </tbody>
float ceil( float arg );
double ceil( double arg );
long double ceil( long double arg );
double ceil( Integral arg );
( C++11)
arg.
:
Computes nearest integer not less than arg.
Google.
. .

arg
:
floating point value
Google.
. .

, arg
:
Nearest integer not less than arg
Google.
. .
[[Image:
:
{{{2}}}
Google.
. .
|200x200px]]
Argument

( ) ( ), , .
:
If the argument is infinity (positive or negative) or zero (positive or negative), the return value is the same as the argument.
Google.
. .
, .
:
The largest representable floating-point values are exact integers in all standard floating-point formats, so this function never overflows.
Google.
. .
, , FE_INEXACT .
:
This function may, but is not required to, raise FE_INEXACT floating-point exceptions for non-integer arguments.
Google.
. .

#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)

() []

Web Proxy Viewer  |  New URL  |  Original Page