amath  1.8.5
Simple command line calculator
round.c File Reference

Round function. More...

#include "prim.h"
Include dependency graph for round.c:

Go to the source code of this file.

Functions

double round (double x)
 Round function. More...
 

Detailed Description

Round function.

Definition in file round.c.

Function Documentation

◆ round()

double round ( double  x)

Round function.

Definition at line 40 of file round.c.

References ceil(), and floor().

Referenced by cround(), PositionalNumeralSystem::GetText(), and RealNumber::Round().

41 {
42  return x > 0.0
43  ? floor(x + 0.5)
44  : ceil(x - 0.5);
45 }
double ceil(double x)
Ceiling function.
Definition: ceil.c:63
double floor(double x)
Floor function.
Definition: floor.c:62
Here is the call graph for this function:
Here is the caller graph for this function: