Skip to content

Commit

Permalink
add Float::{INFINITY,NAN} if available
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Nov 12, 2014
1 parent 887e9f4 commit 70c9866
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 70c9866

Please sign in to comment.