altos/scheme: Support scheme subsetting via feature settings
[fw/altos] / src / scheme / ao_scheme_float.c
index 541f02644f37f51043210968fe82585325e3e8c3..c026c6fb1fd477f9f612e79016beecbb4d287213 100644 (file)
@@ -15,6 +15,8 @@
 #include "ao_scheme.h"
 #include <math.h>
 
+#ifdef AO_SCHEME_FEATURE_FLOAT
+
 static void float_mark(void *addr)
 {
        (void) addr;
@@ -39,6 +41,10 @@ const struct ao_scheme_type ao_scheme_float_type = {
        .name = "float",
 };
 
+#ifndef FLOAT_FORMAT
+#define FLOAT_FORMAT "%g"
+#endif
+
 void
 ao_scheme_float_write(ao_poly p)
 {
@@ -54,7 +60,7 @@ ao_scheme_float_write(ao_poly p)
                        printf("+");
                printf("inf.0");
        } else
-               printf ("%g", f->value);
+               printf (FLOAT_FORMAT, v);
 }
 
 float
@@ -146,3 +152,4 @@ ao_scheme_do_sqrt(struct ao_scheme_cons *cons)
                return ao_scheme_error(AO_SCHEME_INVALID, "%s: non-numeric", ao_scheme_poly_atom(_ao_scheme_atom_sqrt)->name);
        return ao_scheme_float_get(sqrtf(ao_scheme_poly_number(value)));
 }
+#endif