aboutsummaryrefslogtreecommitdiffstats
path: root/math.c
Commit message (Collapse)AuthorAgeFilesLines
* * configure.in (rb_cv_lgamma_r_pm0): check if lgamma_r(+0.0)odaira2016-04-271-1/+4
| | | | | | | | | 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
* configure.in: check lgamma_r(-0.0)nobu2016-04-061-1/+1
| | | | | | | | * 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
* lgamma_r.c: fix at -0.0nobu2016-04-061-1/+1
| | | | | | | | | * 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 (ruby_lgamma_r): mswin's lgamma_r also seems to be wrong.usa2016-04-051-1/+1
| | | | | | | cf. [Bug #12249] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c: fix lgammanobu2016-04-051-0/+16
| | | | | | * 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
* math.c: fix tgammanobu2016-04-051-4/+10
| | | | | | | * 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
* object.c: rb_num_to_dblnobu2015-08-131-46/+1
| | | | | | * 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
* ruby/missing.h: M_PI fallback definitionnobu2015-07-211-3/+0
| | | | | | | * 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
* * math.c (math_log1, math_log2, math_log10): refactoringgogotanaka2015-03-161-23/+18
| | | | | | and tests for this. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_cbrt): [DOC] Fix domain and codomain.gogotanaka2015-03-151-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c: more robustnobu2015-03-141-3/+2
| | | | | | * 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 (math_gamma): rename NGAMMA_TABLE to NFACT_TABLE.gogotanaka2015-03-141-3/+3
| | | | | | specify the size of the fact_table. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_gamma): explicit cast to double.gogotanaka2015-03-141-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_gamma): optimization for passed small integer.gogotanaka2015-03-141-7/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c: fix tgamma on mingwnobu2015-03-101-0/+10
| | | | | | | * 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: refactoring: remove unnecessary variable d0 to unify codegogotanaka2015-03-051-40/+33
| | | | | | appearance. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (num2dbl_with_to_f): direct casting from Rational to double.gogotanaka2015-03-031-2/+13
| | | | | | [Feature #10909] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c: optimization for Bignumnobu2015-01-301-7/+32
| | | | | | | * 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: deoptimizenobu2015-01-291-2/+17
| | | | | | | | * 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_Doublenobu2015-01-291-59/+28
| | | | | | | * 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): revive documentation before r49220.hsbt2015-01-181-1/+3
| | | | | | 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
* * math.c (math_atan2): improve documentation.hsbt2015-01-121-2/+2
| | | | | | [Feature #10323][ruby-core:65400][ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Include ruby.h and ruby/encoding.h to beakr2014-11-151-1/+0
| | | | | | | | includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* constify parametersnobu2014-06-181-2/+2
| | | | | | | | * 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
* configure.in: check atan2nobu2014-05-121-2/+1
| | | | | | | * 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
* * math.c (rb_math_sqrt): omitted exporting an unused function,tadf2014-05-051-0/+2
| | | | | | | | anyway. * internal.h: follows the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_atan2): remove the condition for test.nobu2014-05-041-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c: C99-like atan2nobu2014-05-041-1/+18
| | | | | | | | * 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: check domain of base argumentnobu2014-05-031-8/+17
| | | | | | | | | * 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
* math.c: adjust prototype of math_lognobu2014-05-031-2/+2
| | | | | | * math.c (math_log): adjust prototype as method function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.akr2014-02-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (BIGNUM_EMBED_LEN_NUMBITS): Renamed from RBIGNUM_EMBED_LEN_NUMBITS. (BIGNUM_EMBED_LEN_MAX): Renamed from RBIGNUM_EMBED_LEN_MAX. (BIGNUM_SIGN_BIT): Renamed from RBIGNUM_SIGN_BIT. (BIGNUM_SIGN): Renamed from RBIGNUM_SIGN. (BIGNUM_SET_SIGN): Renamed from RBIGNUM_SET_SIGN. (BIGNUM_POSITIVE_P): Renamed from RBIGNUM_POSITIVE_P. (BIGNUM_NEGATIVE_P): Renamed from RBIGNUM_NEGATIVE_P. (BIGNUM_EMBED_FLAG): Renamed from RBIGNUM_EMBED_FLAG. (BIGNUM_EMBED_LEN_MASK): Renamed from RBIGNUM_EMBED_LEN_MASK. (BIGNUM_EMBED_LEN_SHIFT): Renamed from RBIGNUM_EMBED_LEN_SHIFT. (BIGNUM_LEN): Renamed from RBIGNUM_LEN. (RBIGNUM_DIGITS): Renamed from RBIGNUM_DIGITS. (BIGNUM_LENINT): Renamed from RBIGNUM_LENINT. * bignum.c: Follow the above change. * gc.c: Ditto. * marshal.c: Ditto. * math.c: Ditto. * numeric.c: Ditto. * random.c: Ditto. * rational.c: Ditto. * sprintf.c: Ditto. * ext/-test-/bignum/bigzero.c: Ditto. * ext/-test-/bignum/intpack.c: Ditto. * ext/bigdecimal/bigdecimal.c: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c: fix for Bignum argumentnobu2013-09-281-3/+12
| | | | | | | * math.c (math_log, math_log2, math_log10): fix for Bignum argument. numbits should be add only when right shifted. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bignum.c, math.c: RB_BIGNUM_TYPE_Pnobu2013-09-071-3/+5
| | | | | | | * bignum.c, math.c (RB_BIGNUM_TYPE_P): predicate macro like RB_FLOAT_TYPE_P. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bignum.c, math.c: type predicatesnobu2013-09-071-3/+3
| | | | | | * bignum.c, math.c: use type predicate macros instead of TYPE(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_log): Test the sign for bignums.akr2013-09-071-3/+3
| | | | | | | | | (math_log2): Ditto. (math_log10): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_log): Support bignums bigger than 2**1024.akr2013-09-071-0/+28
| | | | | | | | | (math_log2): Ditto. (math_log10): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h (numberof): Gathered from various files.akr2013-06-071-2/+0
| | | | | | | | | | * array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c, load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c, error.c, ruby.c: Remove the definitions of numberof. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c: ASCII minusnobu2013-06-021-11/+11
| | | | | | * math.c: use ASCII minus (-) instead of U+2212. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c: improve and fix documentation of sin, tan and logeregon2013-05-201-9/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c: RDoc formatting of Math core docs with domains and codomainszzak2013-05-191-96/+218
| | | | | | | Patch by @eLobato [Fixes GH-309] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/util.h: removed extra semicolon in definition oftadf2012-11-211-1/+1
| | | | | | | | | | | | macro. * compile.c: ditto. * cont.c: ditto. * math.c: ditto. * node.c: ditto. * parse.y: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: use "__sun" instead of "__sun__" to detect SunOS.akr2011-10-241-1/+1
| | | | | | | | | | | | | | | | * math.c: ditto. * hash.c: ditto. * atomic.h: ditto. * ext/io/wait/wait.c: ditto. [ruby-dev:44693] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * use RB_TYPE_P which is optimized for constant types, instead ofnobu2011-09-291-1/+1
| | | | | | comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (f_signbit): fix compile error in gcc4 on Solaris withngoto2011-08-051-2/+3
| | | | | | | | | CFLAGS="-std=gnu99". [ruby-dev:44355] fix [Bug #5159] * math.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Forward-ports r32777 from branches/ruby_1_9_3 to trunk.yugui2011-07-311-0/+4
| | | | | | | | | | -- * complex.c (f_signbit): gcc4 on Solaris DOES have signbit but does not have it on header. * math.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c: Attach documentation for Math.drbrain2011-06-291-0/+2
| | | | | | | | | | | | | | | | | | | | * object.c: Document NIL, TRUE, FALSE. * io.c: Improve grammar in ARGF comment. Document STDIN/OUT/ERR. Document ARGF global constant. * lib/rake: Hide deprecated toplevel constants from RDoc (import from rake trunk). * lib/thwait.rb: Document ThWait. * lib/mathn.rb: Hide Math redefinition from RDoc * lib/sync.rb: Add a basic comment for Sync_m, Synchronizer_m, Sync, Synchronizer. * parse.y: Document SCRIPT_LINES__. * hash.c: Document ENV class and global constant. * vm.c: Document TOPLEVEL_BINDING. * version.c: Document RUBY_* constants. * ruby.c: Document DATA and ARGV. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: declare internal functions here.akr2011-06-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * node.h: declare NODE dependent internal functions here. * iseq.h: declare rb_iseq_t dependent internal functions here. * vm_core.h: declare rb_thread_t dependent internal functions here. * bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c, enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c, iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y, proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c, thread.c, time.c, transcode.c, variable.c, vm.c, tool/compile_prelude.rb: don't declare internal functions declared in above headers. include above headers if required. Note that rb_thread_mark() was declared as void rb_thread_mark(rb_thread_t *th) in cont.c but defined as void rb_thread_mark(void *ptr) in vm.c. Now it is declared as the later in internal.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_atan2): you should know that M_PI is not the featureusa2010-08-271-0/+3
| | | | | | | | of C90. fixed build failure caused by r29115. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_atan2): change the behavior when x and y are zero.mrkn2010-08-271-1/+7
| | | | | | | * test/ruby/test_math.rb (test_atan2): add tests for the above changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: Documentation: change => in call-seq to ->.marcandre2010-05-171-26/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Harmonize "#=>" in examples. [ruby-core:30206] * bignum.c: ditto * class.c: ditto * compar.c: ditto * cont.c: ditto * dir.c: ditto * encoding.c: ditto * enum.c: ditto * enumerator.c: ditto * error.c: ditto * eval.c: ditto * file.c: ditto * gc.c: ditto * io.c: ditto * load.c: ditto * marshal.c: ditto * math.c: ditto * numeric.c: ditto * object.c: ditto * pack.c: ditto * proc.c: ditto * process.c: ditto * random.c: ditto * range.c: ditto * re.c: ditto * ruby.c: ditto * signal.c: ditto * sprintf.c: ditto * string.c: ditto * struct.c: ditto * thread.c: ditto * time.c: ditto * transcode.c: ditto * variable.c: ditto * vm_eval.c: ditto * vm_method.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e