diff options
| author | Yuichiro MASUI <[email protected]> | 2012-10-27 14:26:50 +0900 |
|---|---|---|
| committer | Yuichiro MASUI <[email protected]> | 2012-10-27 14:26:50 +0900 |
| commit | 15f46a1feba74cba4f25ec99df79a3f1e07b0b09 (patch) | |
| tree | 04bbc7fceaf3ee7ddbcfb1dfbf623aaebff720ef /src/numeric.c | |
| parent | 559933f577d5073464aa06facc1b754de6225d8a (diff) | |
| download | mruby-15f46a1feba74cba4f25ec99df79a3f1e07b0b09.tar.gz mruby-15f46a1feba74cba4f25ec99df79a3f1e07b0b09.zip | |
define convert method mrb_int/mrb_float with C string
Diffstat (limited to 'src/numeric.c')
| -rw-r--r-- | src/numeric.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/numeric.c b/src/numeric.c index 102e52827..c1491ac51 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -246,8 +246,8 @@ flodivmod(mrb_state *mrb, mrb_float x, mrb_float y, mrb_float *divp, mrb_float * mrb_float div, mod; if (y == 0.0) { - *divp = strtod("inf", NULL); - *modp = strtod("nan", NULL); + *divp = str_to_mrb_float("inf"); + *modp = str_to_mrb_float("nan"); return; } mod = fmod(x, y); @@ -778,7 +778,7 @@ fix_mod(mrb_state *mrb, mrb_value x) mrb_int mod; if (mrb_fixnum(y) == 0) { - return mrb_float_value(strtod("nan", NULL)); + return mrb_float_value(str_to_mrb_float("nan")); } fixdivmod(mrb, a, mrb_fixnum(y), 0, &mod); return mrb_fixnum_value(mod); @@ -807,8 +807,8 @@ fix_divmod(mrb_state *mrb, mrb_value x) mrb_int div, mod; if (mrb_fixnum(y) == 0) { - return mrb_assoc_new(mrb, mrb_float_value(strtod("inf", NULL)), - mrb_float_value(strtod("nan", NULL))); + return mrb_assoc_new(mrb, mrb_float_value(str_to_mrb_float("inf")), + mrb_float_value(str_to_mrb_float("nan"))); } fixdivmod(mrb, mrb_fixnum(x), mrb_fixnum(y), &div, &mod); return mrb_assoc_new(mrb, mrb_fixnum_value(div), mrb_fixnum_value(mod)); |
