aboutsummaryrefslogtreecommitdiffstats
path: root/math.c
Commit message (Collapse)AuthorAgeFilesLines
* * 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
* * error.c: RDoc for subclasses of Exception. [ruby-core:28394]marcandre2010-05-081-0/+16
| | | | | | | | | | | | | | | | | | | | | | * cont.c: ditto * enumerator.c: ditto * io.c: ditto * math.c: ditto * numeric.c: ditto * proc.c: ditto * re.c: ditto * thread.c: ditto * transcode.c: ditto. Thanks to Run Paint for some of the documentation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c: Math::DomainError < StandardException [ruby-core:29855]marcandre2010-04-301-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (rb_eMathDomainError): new exception class for representing ↵muraken2010-02-281-71/+46
| | | | | | | | | | mathematical domain error instead of Errno::EDOM. * math.c (domain_check, infinity_check): removed, no longer needed. * math.c (math_atan2, math_acos, math_asin, math_acosh, math_atanh, math_log, math_log2, math_log10, math_sqrt, math_gamma, math_lgamma): mathematical domain errors are checked and raised before calling libm's functions. * test/ruby/test_math.rb: updated for changes of maht.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_atanh): raise ERANGE without calling atanh if absolutemame2010-02-181-0/+7
| | | | | | | | | value is 1 to achieve platform-independent math. [ruby-core:28219] * math.c (math_lgamma): return [Infinity, 1] without calling lgamma_r if argument is infinity or -infinity. [ruby-core:28219] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_lgamma): initialize sign becauseakr2010-02-061-1/+1
| | | | | | | lgamma(NaN) doesn't set the sign in OpenSolaris. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (domain_check): ignore errno if y is inf.naruse2010-01-251-1/+4
| | | | | | | | r26335 is because NetBSD 5.0's asin and acos returns 0.0 with errno EDOM. But it breaks Linux whose gamma returns inf with errno ERANGE on. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (domain_check): check errno first.nobu2010-01-171-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2009-12-271-0/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_gamma): fix incorrect comparison expression.takano322009-11-181-4/+3
| | | | | | | see also [ruby-dev:39709] [Bug #2381] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2009-11-171-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_atanh): reverted r25279.yugui2009-10-101-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_atanh): Fix bug for Math.atanh(+/-1). It now returns ↵marcandre2009-10-101-1/+0
| | | | | | +-Infinity. [ruby-core:26028] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update comment.akr2009-09-051-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_gamma): get rid of direct comparison between toonobu2009-09-021-3/+6
| | | | | | | big double and integer, with gcc on x86_64. [ruby-core:25257] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (domain_check): simplified.nobu2009-09-021-9/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_gamma): constified fact_table.nobu2009-09-021-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2009-05-131-29/+28
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update rdoc.akr2009-05-061-0/+22
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_gamma): use a table for positive small integers.akr2009-05-061-11/+45
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (Need_Float): call rb_to_float() only when it is reallymatz2009-02-231-1/+1
| | | | | | needed. small performance improvement. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* stripped trailing spaces.nobu2009-02-221-30/+30
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c: SEGV is caused by implicit rb_to_float declarationtakano322009-01-281-0/+1
| | | | | | | test_complexrational.rb: [BUG] at IA-64 architecture git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * object.c (rb_to_float): replaced by to_flo definition frommatz2008-12-311-14/+1
| | | | | | | | math.c [ruby-dev:37668] * math.c (Need_Float): use rb_to_float(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (domain_check): should not raise EDOM exception for NaNmatz2008-12-101-32/+43
| | | | | | | value if operand is also NaN. affects acos, asin, acosh, atanh, log, log2, log10, sqrt, gamma, lgamma. [ruby-dev:37357] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* inserted a newline.tadf2008-10-281-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (rb_math_{atan2,cos,cosh,hypot,log,sin,sinh,sqrt}): added.tadf2008-10-281-9/+40
| | | | | | | | * complex.c: follows the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20005 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_log): should check argc.tadf2008-09-211-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.matz2008-09-051-30/+30
| | | | | | | a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp> in [ruby-dev:36102]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_atanh): raise EDOM on FreeBSD when atanh(1).naruse2008-07-281-3/+23
| | | | | | | | | | | | * math.c (math_log): ditto. * math.c (math_log2): ditto. * math.c (math_log10): ditto. * test/ruby/test_math.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add an example to rdoc of sqrt and cbrt.akr2008-06-151-1/+43
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * suppress warnings with -Wwrite-string.nobu2008-05-311-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (to_flo): rb_Float() accepts even strings for input.matz2008-05-161-1/+14
| | | | | | | | | | | * complex.c (nucomp_to_f): fix wrong message. * complex.c (nucomp_to_r): ditto. * object.c (rb_Float): do not check NaN for error. NaN is a part of valid float values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_div): [ruby-dev:34357]tadf2008-04-141-1/+1
| | | | | | | | | | | | * complex.c (nucomp_abs): use hypot. * complex.c (nucomp_quo): do not force convertion. * test/ruby/test_complex.rb: omitted some meaningless tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/cmath.rb: new.tadf2008-04-051-8/+8
| | | | | | | | | | | | * lib/complex.rb: depends lib/cmath.rb. * lib/rational.rb: added rdiv. * complex.c: removed some math functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_cbrt): new method Math.cbrt.akr2008-02-091-0/+15
| | | | | | | | | * configure.in (cbrt): check for replacement functions. * missing/cbrt.c: new file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_gamma): add error check.akr2008-02-091-2/+10
| | | | | | | (math_lgamma): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix lgamma doc.akr2008-02-071-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_gamma): new method Math.gamma.akr2008-02-071-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | (math_lgamma): new method Math.lgamma. * include/ruby/missing.h (tgamma): declared unless HAVE_TGAMMA. (lgamma_r): declared unless HAVE_LGAMMA_R. * configure.in (tgamma): check for replacement funtions. (lgamma_r): ditto. * missing/tgamma.c: new file. based on gamma.c from "C-gengo niyoru saishin algorithm jiten" (New Algorithm handbook in C language) (Gijyutsu hyouron sha, Tokyo, 1991) by Haruhiko Okumura. * missing/lgamma_r.c: ditto. * LEGAL (missing/tgamma.c): describe as public domain. (missing/lgamma_r.c): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c: fix comment. [ruby-dev:33275]mame2008-01-231-1/+1
| | | | | | | * math.c: fix comment. [ruby-dev:33276] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/json, lib/json, test/json: Update to JSON 1.1.2.naruse2007-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | (RubyForge#15447) * math.c: fix typo. -- M ChangeLog M math.c M ext/json/ext/generator/generator.c M ext/json/ext/parser/parser.rl M ext/json/ext/parser/parser.c M lib/json/version.rb M lib/json/editor.rb M lib/json/common.rb M lib/json/pure/parser.rb M test/json/test_json_unicode.rb M test/json/test_json_fixtures.rb M test/json/test_json_generate.rb M test/json/test_json_addition.rb M test/json/test_json.rb M test/json/runner.rb git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: introduce 2 macros:ko12007-11-131-37/+37
| | | | | | | | | | | | | | | RFLOAT_VALUE(v), DOUBLE2NUM(dbl). Rename RFloat#value -> RFloat#double_value. Do not touch RFloat#double_value directly. * bignum.c, insns.def, marshal.c, math.c, numeric.c, object.c, pack.c, parse.y, process.c, random.c, sprintf.c, string.c, time.c: apply above changes. * ext/dl/mkcallback.rb, ext/json/ext/generator/generator.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c: provide basic features for M17N.matz2007-08-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * parse.y: encoding aware parsing. * parse.y (pragma_encoding): encoding specification pragma. * parse.y (rb_intern3): encoding specified symbols. * string.c (rb_str_length): length based on characters. for older behavior, bytesize method added. * string.c (rb_str_index_m): index based on characters. rindex as well. * string.c (succ_char): encoding aware succeeding string. * string.c (rb_str_reverse): reverse based on characters. * string.c (rb_str_inspect): encoding aware string description. * string.c (rb_str_upcase_bang): encoding aware case conversion. downcase, capitalize, swapcase as well. * string.c (rb_str_tr_bang): tr based on characters. delete, squeeze, tr_s, count as well. * string.c (rb_str_split_m): split based on characters. * string.c (rb_str_each_line): encoding aware each_line. * string.c (rb_str_each_char): added. iteration based on characters. * string.c (rb_str_strip_bang): encoding aware whitespace stripping. lstrip, rstrip as well. * string.c (rb_str_justify): encoding aware justifying (ljust, rjust, center). * string.c (str_encoding): get encoding attribute from a string. * re.c (rb_reg_initialize): encoding aware regular expression * sprintf.c (rb_str_format): formatting (i.e. length count) based on characters. * io.c (rb_io_getc): getc to return one-character string. for older behavior, getbyte method added. * ext/stringio/stringio.c (strio_getc): ditto. * io.c (rb_io_ungetc): allow pushing arbitrary string at the current reading point. * ext/stringio/stringio.c (strio_ungetc): ditto. * ext/strscan/strscan.c: encoding support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby: moved public headers.nobu2007-06-101-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (math_log): update document to mention second optionalmatz2007-02-161-0/+3
| | | | | | argument for logarithm base. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dir.c (dir_s_glob): remove unused variable.matz2006-09-181-1/+1
| | | | | | | | | | | | | * math.c (math_log): ditto. * re.c (rb_reg_regcomp): ditto. * eval.c (break_jump): ditto. * eval.c (rb_thread_yield_0): remove unused function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * math.c (domain_check): ANSI style function argumentsmatz2006-07-271-4/+2
| | | | | | | * math.c (math_log): too few argument to domain_check(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e