diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-02-16 08:14:44 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-02-17 09:35:20 +0900 |
| commit | ffe541b503033aea9adf65224408cbad1cc27d83 (patch) | |
| tree | d30c562e42f931054a2e4f5ddfa70873025511c8 /src/numeric.c | |
| parent | 25ea4d751bc2d27372e17185399155dfa099ddc9 (diff) | |
| download | mruby-ffe541b503033aea9adf65224408cbad1cc27d83.tar.gz mruby-ffe541b503033aea9adf65224408cbad1cc27d83.zip | |
small refactoring; direct return
Diffstat (limited to 'src/numeric.c')
| -rw-r--r-- | src/numeric.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/numeric.c b/src/numeric.c index d56ef9764..b5e77fed0 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -106,7 +106,6 @@ num_div(mrb_state *mrb, mrb_value x) mrb_value mrb_flo_to_str(mrb_state *mrb, mrb_value flo, int max_digit) { - mrb_value result; mrb_float n; if (max_digit > 40) { @@ -119,14 +118,14 @@ mrb_flo_to_str(mrb_state *mrb, mrb_value flo, int max_digit) n = mrb_float(flo); if (isnan(n)) { - result = mrb_str_new_lit(mrb, "NaN"); + return mrb_str_new_lit(mrb, "NaN"); } else if (isinf(n)) { if (n < 0) { - result = mrb_str_new_lit(mrb, "-inf"); + return mrb_str_new_lit(mrb, "-inf"); } else { - result = mrb_str_new_lit(mrb, "inf"); + return mrb_str_new_lit(mrb, "inf"); } } else { @@ -202,10 +201,8 @@ mrb_flo_to_str(mrb_state *mrb, mrb_value flo, int max_digit) *c = '\0'; - result = mrb_str_new(mrb, &s[0], c - &s[0]); + return mrb_str_new(mrb, &s[0], c - &s[0]); } - - return result; } /* 15.2.9.3.16(x) */ |
