Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/numeric/math/round"

From cppreference.com
< cpp‎ | numeric‎ | math
m (Shorten template names. Use {{lc}} where appropriate.)
m (Update links.)
Line 56: Line 56:
  
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/numeric/math/dcl list floor}}
+
{{dsc inc | cpp/numeric/math/dsc floor}}
{{dsc inc | cpp/numeric/math/dcl list ceil}}
+
{{dsc inc | cpp/numeric/math/dsc ceil}}
{{dsc inc | cpp/numeric/math/dcl list trunc}}
+
{{dsc inc | cpp/numeric/math/dsc trunc}}
 
{{dsc end}}
 
{{dsc end}}
  

Revision as of 22:18, 31 May 2013

 
 
 
 
Defined in header <cmath>
float round( float arg );
(since C++11)
double round( double arg );
(since C++11)
long double round( long double arg );
(since C++11)
double round( Integral arg );
(since C++11)
long lround( float arg );
(since C++11)
long lround( double arg );
(since C++11)
long lround( long double arg );
(since C++11)
long lround( Integral arg );
(since C++11)
long long llround( float arg );
(since C++11)
long long llround( double arg );
(since C++11)
long long llround( long double arg );
(since C++11)
long long llround( Integral arg );
(since C++11)

Computes nearest integer to arg. Number is rounded away from zero in halfway cases

Parameters

arg - floating point value

Return value

Nearest integer to arg.

Return value
math-round away zero.svg
Argument

See also

(C++11)(C++11)
nearest integer not greater than the given value
(function) [edit]
(C++11)(C++11)
nearest integer not less than the given value
(function) [edit]
(C++11)(C++11)(C++11)
nearest integer not greater in magnitude than the given value
(function) [edit]