Project

General

Profile

Actions

Feature #2347

closed

Math::INFINITY

Added by marcandre (Marc-Andre Lafortune) about 15 years ago. Updated over 12 years ago.

Status:
Closed
Target version:
[ruby-core:26632]

Description

=begin
It is easy to get an infinity in Ruby (ex: 1.0/0) but that may not be obvious to everyone.

Could we have Math::INFINITY which would make code using it cleaner?

Thanks

diff --git a/math.c b/math.c
index 51caf35..653a239 100644
--- a/math.c
+++ b/math.c
@@ -764,6 +764,7 @@ Init_Math(void)
#else
rb_define_const(rb_mMath, "E", DBL2NUM(exp(1.0)));
#endif

  • rb_define_const(rb_mMath, "INFINITY", DBL2NUM(1.0/0.0));

    rb_define_module_function(rb_mMath, "atan2", math_atan2, 2);
    rb_define_module_function(rb_mMath, "cos", math_cos, 1);
    =end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0