From: Marc-Andre Lafortune <redmine@...>
Date: 2009-11-09T04:53:15+09:00
Subject: [ruby-core:26632] [Feature #2347] Math::INFINITY

Feature #2347: Math::INFINITY
http://redmine.ruby-lang.org/issues/show/2347

Author: Marc-Andre Lafortune
Status: Open, Priority: Normal
Assigned to: Yukihiro Matsumoto, Category: core, Target version: 1.9.2

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);


----------------------------------------
http://redmine.ruby-lang.org