diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-11-12 15:46:31 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-11-12 15:46:31 +0900 |
| commit | 70c98667512b9301e577aafc912a35208ad471c9 (patch) | |
| tree | 06d6dadd6704640634a9a968c531c2639b62bea2 /src/numeric.c | |
| parent | 887e9f42256eb013af7ea062fcc53ffd76ffe1c9 (diff) | |
| download | mruby-70c98667512b9301e577aafc912a35208ad471c9.tar.gz mruby-70c98667512b9301e577aafc912a35208ad471c9.zip | |
add Float::{INFINITY,NAN} if available
Diffstat (limited to 'src/numeric.c')
| -rw-r--r-- | src/numeric.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/numeric.c b/src/numeric.c index 71dadf35f..e01e661a5 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -1337,4 +1337,11 @@ mrb_init_numeric(mrb_state *mrb) mrb_define_method(mrb, fl, "to_s", flo_to_s, MRB_ARGS_NONE()); /* 15.2.9.3.16(x) */ mrb_define_method(mrb, fl, "inspect", flo_to_s, MRB_ARGS_NONE()); mrb_define_method(mrb, fl, "nan?", flo_nan_p, MRB_ARGS_NONE()); + +#ifdef INFINITY + mrb_define_const(mrb, fl, "INFINITY", mrb_float_value(mrb, INFINITY)); +#endif +#ifdef NAN + mrb_define_const(mrb, fl, "NAN", mrb_float_value(mrb, NAN)); +#endif } |
