aboutsummaryrefslogtreecommitdiff
path: root/libntp/fptoa.c
diff options
context:
space:
mode:
Diffstat (limited to 'libntp/fptoa.c')
-rw-r--r--libntp/fptoa.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libntp/fptoa.c b/libntp/fptoa.c
new file mode 100644
index 000000000000..025ad21e55b4
--- /dev/null
+++ b/libntp/fptoa.c
@@ -0,0 +1,25 @@
+/*
+ * fptoa - return an asciized representation of an s_fp number
+ */
+#include "ntp_fp.h"
+#include "ntp_stdlib.h"
+
+char *
+fptoa(
+ s_fp fpv,
+ short ndec
+ )
+{
+ u_fp plusfp;
+ int neg;
+
+ if (fpv < 0) {
+ plusfp = (u_fp)(-fpv);
+ neg = 1;
+ } else {
+ plusfp = (u_fp)fpv;
+ neg = 0;
+ }
+
+ return dofptoa(plusfp, neg, ndec, 0);
+}