It seems HUGE_VAL is already used. Why not eliminate INTINITY.
NAN is also float. That of double is called nan(). This is also
fixed.
Signed-off-by: Urabe, Shyouhei <shyouhei@ruby-lang.org>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (math_lgamma): check the argument before calling math
function `lgamma_r` for edge cases.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (math_gamma): check the argument before calling math
function `tgamma` for edge cases.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.in: do not use buggy tgamma() of mingw.
* missing/tgamma.c (tgamma): merge fix for inifity from
ruby_tgamma. since msvcr120.dll and later have tgamma, this
implementation will not be used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (tgamma): it seems that the implementaion of mswin has similar problem
with mingw.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c: [DOC] mention possibly surprising behavior of Math.sqrt
due to floating point arithmetic; also refer to BigDecimal#sqrt.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (exp1, exp2): use immediate 0 instead of rb_mMath, which
is never used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (ifdef M_PI): M_PI is eventually defined in missing.h even if math.h
doesn't supply it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (tanh): make faster by the extract form if three
hyperbolic functions are unavailable. [Feature #12647]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
because internal.h includes ruby.h, ruby.h includes win32.h, and
win32.h includes system's math.h.
this change is to get rid of a compiler warning (redefinition of
a macro) introduced at r55641.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (get_double_rshift): extract bignum to double conversion
with bit offset.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (math_log1, math_log10): use common math constants
instead of math function calls.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
returns positive infinity, in addition to lgamma_r(-0.0).
AIX returns an incorrect result of negative infinity.
* math.c (ruby_lgamma_r): handle +0.0, in addition to -0.0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (ruby_lgamma_r): missing/lgamma_r.c is used on Windows,
since msvcrt does not provide it.
* missing/lgamma_r.c (lgamma_r): fix lgamma(-0.0).
[ruby-core:74823] [Bug #12249]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (math_gamma): make more robust against addition/removal.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (mingw_tgamma): tgamma(3) on mingw returns a NaN for a
big number, not infinity.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (num2dbl_with_to_f): make faster when Bignum passed by
direct conversion using rb_big2dbl(). [Feature #10800]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (Get_Double): restrict direct casting only when
Fixnum#to_f is not redefined, and convert with rb_to_float().
[Feature #10785]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (Get_Double): direct casting from Fixnum to double.
[Feature #10785]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (math_atan2): return values like as expected by C99 if
both two arguments are infinity. based on the patch by cremno
phobia <cremno AT mail.ru> in [ruby-core:62310]. [Feature #9799]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c (math_log): check domain of base argument too. raises
Math::DomainError instead of returning NaN if the base is less
than 0, and returns NaN instead of -infinity if both of two
arguments are 0. [ruby-core:62309] [Bug #9797]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e