diff options
Diffstat (limited to 'reference/C/CONTRIB/SNIP/round.h')
-rwxr-xr-x | reference/C/CONTRIB/SNIP/round.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/reference/C/CONTRIB/SNIP/round.h b/reference/C/CONTRIB/SNIP/round.h new file mode 100755 index 0000000..6736c06 --- /dev/null +++ b/reference/C/CONTRIB/SNIP/round.h @@ -0,0 +1,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)))
|