summary refs log tree commit diff
path: root/tools/fptox.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/fptox.c')
-rw-r--r--tools/fptox.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/fptox.c b/tools/fptox.c
new file mode 100644
index 0000000..a2bc155
--- /dev/null
+++ b/tools/fptox.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int ac, char *av[])
+{
+	double d;
+	float f;
+
+	if (ac < 2) {
+	usage:
+		fputs("usage: fptox NUMBER\n", stderr);
+		return 1;
+	}
+	f = d = strtod(av[1], 0);
+	printf("0x%08x 0x%016llx\n", *(unsigned *)&f, *(unsigned long long*)&d);
+	return 0;
+}