From fad7908a5de4ab08367914d53780ff6518d5f552 Mon Sep 17 00:00:00 2001 From: "S.H" Date: Tue, 9 Feb 2021 13:29:42 +0900 Subject: Improve performance Float#positive? and Float#negative? [Feature #17614] (#4160) --- numeric.c | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'numeric.c') diff --git a/numeric.c b/numeric.c index 97fc239211..bcc0ab7c61 100644 --- a/numeric.c +++ b/numeric.c @@ -2384,34 +2384,6 @@ flo_truncate(int argc, VALUE *argv, VALUE num) return flo_floor(argc, argv, num); } -/* - * call-seq: - * float.positive? -> true or false - * - * Returns +true+ if +float+ is greater than 0. - */ - -static VALUE -flo_positive_p(VALUE num) -{ - double f = RFLOAT_VALUE(num); - return f > 0.0 ? Qtrue : Qfalse; -} - -/* - * call-seq: - * float.negative? -> true or false - * - * Returns +true+ if +float+ is less than 0. - */ - -static VALUE -flo_negative_p(VALUE num) -{ - double f = RFLOAT_VALUE(num); - return f < 0.0 ? Qtrue : Qfalse; -} - /* * call-seq: * num.floor([ndigits]) -> integer or float @@ -5654,8 +5626,6 @@ Init_Numeric(void) rb_define_method(rb_cFloat, "finite?", rb_flo_is_finite_p, 0); rb_define_method(rb_cFloat, "next_float", flo_next_float, 0); rb_define_method(rb_cFloat, "prev_float", flo_prev_float, 0); - rb_define_method(rb_cFloat, "positive?", flo_positive_p, 0); - rb_define_method(rb_cFloat, "negative?", flo_negative_p, 0); } #undef rb_float_value -- cgit v1.2.3