====== ceil() ======
ceil ist definiert in der ''[[start|math]]'', die in C über ''math.h'', bzw. in C++ über ''cmath'' eingebunden wird.
===== Funktion =====
ceil() rundet den übergebenen Fließkommawert auf die nächst höhere natürliche Zahl. Die Nachkommastellen werden gewissermaßen weggelassen und eins addiert. Zurückgegeben wird ebenfalls als Fließkommazahl.
===== Signatur =====
#include
double ceil ( double x );
float ceil ( float x );
long double ceil ( long double x );
**x**: der aufzurundende Wert
**Return value**: Der zur nächst höheren Zahl aufgerundete Wert.
===== Fehlerquellen =====
-
===== Beispiel =====
#include // für EXIT_SUCCESS
#include // für ceil
#include // für printf()
int main( void )
{
printf( "ceil( 1.1 ) : %f\n", ceil( 1.1 ) );
printf( "ceil( 1.9 ) : %f\n", ceil( 1.9 ) );
printf( "ceil( -1.1 ) : %f\n", ceil( -1.1 ) );
printf( "ceil( -1.9 ) : %f\n", ceil( -1.9 ) );
return EXIT_SUCCESS;
}
Ausgabe:
ceil( 1.1 ) : 2.0
ceil( 1.9 ) : 2.0
ceil( -1.1 ) : -1.0
ceil( -1.9 ) : -1.0
===== siehe auch =====
[[c:lib:math:start|math]]: [[c:lib:math:floor()]], [[c:lib:math:fabs()]], [[c:lib:math:modf()]]