summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c
index c1e248dd9..8f0db681c 100644
--- a/src/string.c
+++ b/src/string.c
@@ -8,7 +8,9 @@
# define _CRT_NONSTDC_NO_DEPRECATE
#endif
+#ifndef MRB_WITHOUT_FLOAT
#include <float.h>
+#endif
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
@@ -2256,6 +2258,7 @@ mrb_str_to_i(mrb_state *mrb, mrb_value self)
return mrb_str_to_inum(mrb, self, base, FALSE);
}
+#ifndef MRB_WITHOUT_FLOAT
MRB_API double
mrb_cstr_to_dbl(mrb_state *mrb, const char * p, mrb_bool badcheck)
{
@@ -2359,6 +2362,7 @@ mrb_str_to_f(mrb_state *mrb, mrb_value self)
{
return mrb_float_value(mrb, mrb_str_to_dbl(mrb, self, FALSE));
}
+#endif
/* 15.2.10.5.40 */
/*
@@ -2760,7 +2764,9 @@ mrb_init_string(mrb_state *mrb)
mrb_define_method(mrb, s, "slice", mrb_str_aref_m, MRB_ARGS_ANY()); /* 15.2.10.5.34 */
mrb_define_method(mrb, s, "split", mrb_str_split_m, MRB_ARGS_ANY()); /* 15.2.10.5.35 */
+#ifndef MRB_WITHOUT_FLOAT
mrb_define_method(mrb, s, "to_f", mrb_str_to_f, MRB_ARGS_NONE()); /* 15.2.10.5.38 */
+#endif
mrb_define_method(mrb, s, "to_i", mrb_str_to_i, MRB_ARGS_ANY()); /* 15.2.10.5.39 */
mrb_define_method(mrb, s, "to_s", mrb_str_to_s, MRB_ARGS_NONE()); /* 15.2.10.5.40 */
mrb_define_method(mrb, s, "to_str", mrb_str_to_s, MRB_ARGS_NONE());
@@ -2771,6 +2777,7 @@ mrb_init_string(mrb_state *mrb)
mrb_define_method(mrb, s, "bytes", mrb_str_bytes, MRB_ARGS_NONE());
}
+#ifndef MRB_WITHOUT_FLOAT
/*
* Source code for the "strtod" library procedure.
*
@@ -3015,3 +3022,4 @@ done:
}
return fraction;
}
+#endif