summaryrefslogtreecommitdiff
path: root/reference/C/CONTRIB/SNIP/round.h
blob: 6736c06e79430d56530a990017a8bb951f16f296 (plain)
1
2
3
4
5
6
7
8
9
10
11
/*
** rounding macros by Dave Knapp & Thad Smith
*/

/* round to integer */

#define iround(x) floor((x)+0.5)

/* round number n to d decimal points */

#define fround(n,d) (floor((n)*pow(10.,(d))+.5)/pow(10.,(d)))