summaryrefslogtreecommitdiff
path: root/math.c
AgeCommit message (Collapse)Author
2018-06-06math.c: adjust cbrtnobu
* math.c (math_cbrt): refine the approximation result on boundary values by an iteration of Newton-Raphson method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-09math.c: calling ordernobu
* math.c (math_log, rb_math_log): inverted calling order, to remove unused argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-19INFINITY is float. That of double is HUGE_VAL.shyouhei
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
2017-05-13math.c: check argument to lgamma_rnobu
* 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
2017-05-13math.c: check argument to tgammanobu
* 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
2017-05-12fix tgamma for inifitynobu
* 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
2017-05-12Math.gamma(Float::INFINITY) should return +INFusa
* 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
2017-05-10math.c (ruby_lgamma_r): reduce duplicate codenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-06math.c: improve docs for Math.sqrtstomar
* math.c: [DOC] mention Integer.sqrt in docs for Math.sqrt. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-09math.c: improve docs for Math.sqrtstomar
* 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
2017-03-05math.c: more accuracynobu
* math.c (math_log10): calculate log10(2) for more accuracy. [ruby-core:79907] [Bug #13279] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-19math.c: unused_objnobu
* 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
2016-11-16math.c: remove needless ifdef clausemrkn
* 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
2016-10-26[DOC] replace Fixnum with Integer [ci skip]nobu
* numeric.c: [DOC] update document for Integer class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-02math.c: faster tanhnobu
* 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
2016-08-02math.c: tanh overflownobu
* math.c (tanh): check overflows, and return +-1.0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-13* math.c (_USE_MATH_DEFINES): it must be set before including internal.husa
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
2016-07-13fix typenaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-13* math.c (rb_math_sqrt): r55646 must use f_signbit.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-12math.c: Complex sqrtnobu
* math.c (rb_math_sqrt): [EXPERIMENTAL] move Complex sqrt support from mathn.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-12math.c: get_double_rshiftnobu
* 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
2016-07-12math.c: use common constantsnobu
* 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
2016-04-27* configure.in (rb_cv_lgamma_r_pm0): check if lgamma_r(+0.0)odaira
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
2016-04-06configure.in: check lgamma_r(-0.0)nobu
* configure.in (rb_cv_lgamma_r_m0): check if lgamma_r(-0.0) returns negative infinity. [Bug #12249] * math.c (ruby_lgamma_r): define by the configured result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-06lgamma_r.c: fix at -0.0nobu
* 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
2016-04-05* math.c (ruby_lgamma_r): mswin's lgamma_r also seems to be wrong.usa
cf. [Bug #12249] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-05math.c: fix lgammanobu
* math.c (ruby_lgamma_r): fix lgamma(-0.0) on mingw and OSX. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-05math.c: fix tgammanobu
* math.c (ruby_tgamma): fix tgamma(-0.0) on mingw. [ruby-core:74817] [Bug #12249] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-13object.c: rb_num_to_dblnobu
* object.c (rb_num_to_dbl): move from num2dbl_with_to_f in math.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21ruby/missing.h: M_PI fallback definitionnobu
* include/ruby/missing.h (M_PI, M_PI_2): fallback definitions for VC6. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-16* math.c (math_log1, math_log2, math_log10): refactoringgogotanaka
and tests for this. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-15* math.c (math_cbrt): [DOC] Fix domain and codomain.gogotanaka
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-14math.c: more robustnobu
* 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
2015-03-14* math.c (math_gamma): rename NGAMMA_TABLE to NFACT_TABLE.gogotanaka
specify the size of the fact_table. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-14* math.c (math_gamma): explicit cast to double.gogotanaka
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-14* math.c (math_gamma): optimization for passed small integer.gogotanaka
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-10math.c: fix tgamma on mingwnobu
* 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
2015-03-05* math.c: refactoring: remove unnecessary variable d0 to unify codegogotanaka
appearance. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-03* math.c (num2dbl_with_to_f): direct casting from Rational to double.gogotanaka
[Feature #10909] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-30math.c: optimization for Bignumnobu
* 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
2015-01-29math.c: deoptimizenobu
* 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
2015-01-29math.c: Get_Doublenobu
* 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
2015-01-18* math.c (math_atan2): revive documentation before r49220.hsbt
http://d.hatena.ne.jp/nagachika/20150112/ruby_trunk_changes_49213_49226 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-12* math.c (math_atan2): improve documentation.hsbt
[Feature #10323][ruby-core:65400][ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-18constify parametersnobu
* include/ruby/intern.h: constify `argv` parameters. * include/ruby/ruby.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-12configure.in: check atan2nobu
* configure.in (rb_cv_atan2_inf_c99): check whether runtime atan2 handles Inf as C99. ruby-core:62536] [Bug #9831] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-05 * math.c (rb_math_sqrt): omitted exporting an unused function,tadf
anyway. * internal.h: follows the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-04* math.c (math_atan2): remove the condition for test.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-04math.c: C99-like atan2nobu
* 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