commit 8937b6c918bc0814e1046a0ff06a206c3fb5ac34
parent cab84cb96b04852f61e2fe1fd0c0ed6ec9fdd0ea
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Wed, 3 Feb 2016 15:50:55 -0500
add tool to show ieee representations
Diffstat:
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/lisc/tools/fptox.c b/lisc/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%016lx\n", *(unsigned *)&f, *(unsigned long long*)&d);
+ return 0;
+}