summaryrefslogtreecommitdiff
path: root/gsl-1.9/doc/examples/ieee.c
diff options
context:
space:
mode:
Diffstat (limited to 'gsl-1.9/doc/examples/ieee.c')
-rw-r--r--gsl-1.9/doc/examples/ieee.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gsl-1.9/doc/examples/ieee.c b/gsl-1.9/doc/examples/ieee.c
new file mode 100644
index 0000000..c7f1110
--- /dev/null
+++ b/gsl-1.9/doc/examples/ieee.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <gsl/gsl_ieee_utils.h>
+
+int
+main (void)
+{
+ float f = 1.0/3.0;
+ double d = 1.0/3.0;
+
+ double fd = f; /* promote from float to double */
+
+ printf (" f="); gsl_ieee_printf_float(&f);
+ printf ("\n");
+
+ printf ("fd="); gsl_ieee_printf_double(&fd);
+ printf ("\n");
+
+ printf (" d="); gsl_ieee_printf_double(&d);
+ printf ("\n");
+
+ return 0;
+}