Граф коммитов

224 Коммитов

Автор SHA1 Сообщение Дата
nobu aa3b506270 add some documents [ci skip]
* bignum.c (Init_Bignum): [DOC] Bignum::GMP_VERSION.

* complex.c (Init_Complex): [DOC] ignore an internal class.

* dir.c (Init_Dir): [DOC] File::FNM_SYSCASE.

* file.c (rb_file_exists_p): [DOC] File.exists? is deprecated.

* object.c (rb_mod_initialize_clone): [DOC] ignore implementation
  detail.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-28 11:28:55 +00:00
shyouhei 62bfc4f24e * include/ruby/ruby.h (struct RComplex): no longer. [Feature #9888]
* include/ruby/ruby.h (RCOMPLEX): ditto.

	* include/ruby/ruby.h (RCOMPLEX_SET_REAL): deprecated.  Will be deleted later.

	* include/ruby/ruby.h (RCOMPLEX_SET_IMAG): ditto.

	* internal.h (struct RFloat): moved here.

	* internal.h (RCOMPLEX): ditto.

	* complex.c (rb_complex_set_real): do not use this.

	* complex.c (rb_complex_set_imag): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-23 04:41:27 +00:00
normal a9befcdb08 avoid large alloca on Complex/Rational calls
* complex.c (parse_comp): replace ALLOCA_N with ALLOCV_N/ALLOCV_END
  [Bug #9608]
* rational.c (read_digits): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-02 19:21:18 +00:00
hsbt cbf4eca61e * complax.c: [DOC] Document number conversion of `nil` by @skade [fix GH-570] [ci skip]
* object.c, rational.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-21 00:45:52 +00:00
nobu 77f3da02a0 complex.c: remove f_inspect and f_to_s
* complex.c (nucomp_to_s): use rb_String.

* complex.c (nucomp_inspect): use rb_inspect.

* complex.c: use PRIsVALUE flag not to use an intermediate string
  which can be collected by GC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-17 04:57:17 +00:00
nobu 6224216294 unused functions and variables
* complex.c, rational.c: remove unused functions, which are warned
  by clang 5.1, and also variables only used by removed functions.

* ext/date/date_core.c: ditto.

* enc/utf_16be.c, enc/utf_16le.c: comment out constants only used
  by commented out functions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-17 04:57:14 +00:00
tadf bb82e49632 * complex.c: removed meaningless lines.
* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-15 22:34:27 +00:00
nobu 9c060a59b4 rational.c: conditionally defined variable
* rational.c (numeric_quo): variable 'canonicalization' is defined
  conditionally by CANON (and CANONICALIZATION_FOR_MATHN).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-10 05:05:50 +00:00
nobu d968e9ecfa complex.c: fix typo
* complex.c (nucomp_real_check): fix a variable name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-09 05:47:47 +00:00
nobu 2b5c2ebfbf complex.c, rational.c: use RB_TYPE_P
* complex.c, rational.c: use RB_TYPE_P() for special classes instead
  of switch with TYPE().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-09 05:17:13 +00:00
ko1 4f401816ff * gc.c: support RGENGC. [ruby-trunk - Feature #8339]
See this ticet about RGENGC.
* gc.c: Add several flags:
* RGENGC_DEBUG: if >0, then prints debug information.
* RGENGC_CHECK_MODE: if >0, add assertions.
* RGENGC_PROFILE: if >0, add profiling features.
  check GC.stat and GC::Profiler.
* include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0).
* array.c: add write barriers for T_ARRAY and generate sunny objects.
* include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if
  you want to access raw pointers. If you modify the contents which
  pointer pointed, then you need to care write barrier.
* bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects.
* complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX
  and generate sunny objects.
* rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write
  barriers for T_RATIONAL and generate sunny objects.
* internal.h: add write barriers for RBasic::klass.
* numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects.
* object.c (rb_class_allocate_instance), range.c:
  generate sunny T_OBJECT objects.
* string.c: add write barriers for T_STRING and generate sunny objects.
* variable.c: add write barriers for ivars.
* vm_insnhelper.c (vm_setivar): ditto.
* include/ruby/ruby.h, debug.c: use two flags
  FL_WB_PROTECTED and FL_OLDGEN.
* node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED):
  move flag bits.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 18:07:47 +00:00
ko1 89e6910f04 * include/ruby/ruby.h: constify RRational::(num,den) and
RComplex::(real,imag).
  Add macro to set these values:
* RRATIONAL_SET_NUM()
* RRATIONAL_SET_DEN()
* RCOMPLEX_SET_REAL()
* RCOMPLEX_SET_IMAG()
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
  TODO: API design. RRATIONAL_SET(rat,num,den) is enough?
  TODO: Setting constify variable with cast has same issue of r40691.
* complex.c, rational.c: use above macros.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 15:55:09 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
zzak 9ef4e13459 * array.c: Document synonymous methods, by windwiny [GH-277]
* bignum.c: ditto
* complex.c: ditto
* dir.c: ditto
* encoding.c: ditto
* enumerator.c: ditto
* numeric.c: ditto
* proc.c: ditto
* re.c: ditto
* string.c: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-12 02:59:07 +00:00
tadf 9a4f037502 * complex.c: edited rdoc.
* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10 08:01:32 +00:00
tadf ec9eabc6c2 * complex.c: described syntax of string form.
* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-10 00:18:52 +00:00
nobu 3d0786a3a8 marshal.c: marshal_dump instance varialbes
* marshal.c (w_object): dump instance varialbes of the result of
  marshal_dump not the original object.  [ruby-core:51163] [Bug #7627]
* complex.c (nucomp_marshal_dump): need to copy instance variables.
* rational.c (nurat_marshal_dump): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-26 13:39:15 +00:00
nobu 9c1b3161f2 complex.c, time.c: make marshal methods private
* complex.c (Init_Complex), time.c (Init_Time): make marshal methods
  private.  [Feature #6539]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 09:17:02 +00:00
tadf d6ec400148 * complex.c (string_to_c_strict, string_to_c): check NUL.
* rational.c (string_to_r_strict, string_to_r): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-22 11:32:52 +00:00
tadf 4d03af3d9c * complex.c (nucomp_to_c): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-21 12:54:06 +00:00
tadf 21453dc738 * complex.c: some improvements.
* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20 12:10:08 +00:00
tadf 42d38decda * complex.c (read_comp): mathn compliant.
* rational.c (read_num): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-18 00:35:06 +00:00
tadf 7a1985a969 trivial changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-18 00:26:15 +00:00
tadf 62f7e108e2 * complex.c (read_comp): modified handling of polar form.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17 17:03:52 +00:00
tadf 8d05671d63 * complex.c (read_comp): fixed handling of polar form.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17 15:51:55 +00:00
tadf 47fe9b79a3 * complex.c (string_to_c_strict, string_to_c): rewrote without regexp.
* rational.c (string_to_r_strict, string_to_r): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17 15:19:55 +00:00
tadf 20039668dd * complex.c (make_patterns): should not accept extra sign.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-17 14:57:22 +00:00
tadf e864787c84 * complex.c: modified doc.
* ratioanl.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-10 10:29:13 +00:00
tadf d4199057bc * complex.c: modified doc.
* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-03 14:39:50 +00:00
nari c3a46d6aca * include/ruby/ruby.h: add C APIs.
VALUE rb_newobj_of(VALUE klass, VALUE flags)
  #define NEWOBJ_OF(obj,type,klass,flags)
  These allow to change a allocation strategy depending on klass
  or flags.

* gc.c: ditto

* array.c: use new C API.
* bignum.c: ditto
* class.c: ditto
* complex.c: ditto
* ext/socket/ancdata.c: ditto
* ext/socket/option.c: ditto
* hash.c: ditto
* io.c: ditto
* marshal.c: ditto
* numeric.c: ditto
* object.c: ditto
* random.c: ditto
* range.c: ditto
* rational.c: ditto
* re.c: ditto
* string.c: ditto
* struct.c: ditto
  [Feature #7177][Feature #7047]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20 06:57:51 +00:00
eregon 63f6cda815 * complex.c: Fix examples of r36993.
Keep the simple definition, mathematics define the result.
  Based on patch by Robin Dupret. Fixes #188 on github.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-22 17:36:47 +00:00
nobu 2b64e10feb remove garbages.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-20 07:06:06 +00:00
zzak 7c4d0468df * complex.c: Examples for Complex Documentation.
Patch by Robin Dupret.
  Fixes #184 on github.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-19 22:23:15 +00:00
tadf a2c5d15572 added a comment
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-04 22:04:20 +00:00
nobu 003c45f9cd complex.c, rational.c: compatible marshal loader
* complex.c, rational.c: compatible marshal loader for compatibilities
  with 1.8.  [ruby-core:45775] [Bug #6625]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-25 08:41:07 +00:00
tadf eb6579e647 * marshal.c: experimental test aborted.
* complex.c: ditto.
	* rational.c: ditto.
	* include/ruby/intern.h: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03 19:26:58 +00:00
tadf f5b06413ca * marshal.c: calls directly rb_{Complex,Rational}_marshal_load().
But now disabled. [experimental]
	* complex.c: followed the above.
	* rational.c: ditto.
	* include/rub/intern.h: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03 12:21:18 +00:00
nobu 694035eb35 use rb_marshal_{dump,load}
* marshal.c: revert r35879 "now marshal_{load|dump} are external."
* complex.c (nucomp_marshal__{dump,load}): should use rb_marshal_{dump,load}.
* rational.c (nurat_marshal__{dump,load}): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03 07:34:03 +00:00
tadf bdc55aa0c6 * complex.c: wrote Complex#_dump and Complex::load. But now
disabled (due to compatibility) [experimental].

	* rational.c: wrote Rational#_dump and Rational::load. ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03 05:05:29 +00:00
tadf 89ae71d721 * complex.c (nucomp_marshal_load): [ruby-core:45394]
* rational.c (nurat_marshal_load): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-03 01:26:41 +00:00
tadf 08df821865 * complex.c (nucomp_expt): [ruby-core:44170].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-08 22:00:32 +00:00
naruse 71d114297f * complex.c (nucomp_expt): the result of f_complex_new2 may be a fixnum
with mathn. [ruby-core:44170] [Bug #6267]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-08 17:53:51 +00:00
tadf 329ae7470e replaced rdoc for Complex::I
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-28 21:53:54 +00:00
naruse eeff98c430 * complex.c (nucomp_marshal_load): raise error on invalid data.
reported by John Firebaugh [ruby-core:42860] [Bug #6076]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-25 07:20:00 +00:00
drbrain af9398ab38 * complex.c (Init_Complex): Document Complex::I. Patch by Sylvain
Daubert.  [Feature #5623]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 00:10:53 +00:00
nobu 292b3e4113 * complex.c (nucomp_rationalize): fix function. [ruby-core:40667]
[Bug #5546]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-02 12:36:06 +00:00
akr 2bb5441808 * complex.c: use "__sun" instead of "__sun__" to detect SunOS.
* 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
2011-10-24 14:57:08 +00:00
nobu 8e6e8e6288 * use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:07:45 +00:00
mrkn 2e2fabc433 * complex.c (nucomp_rationalize): calls rationalize of real part if
imaginary part is exactly zero.  The patch is made by Marc-Andre
  Lafortune.  fixes [Bug #5178] [ruby-core:38885]
* test/ruby/test_complex.rb (test_rationalize): add a test for the
  above change.
* complex.c (nucomp_to_r): fix RDoc comment.  The patch is made by
  Marc-Andre Lafortune.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-10 10:35:08 +00:00
ngoto 700aeee754 * complex.c (f_signbit): fix compile error in gcc4 on Solaris with
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
2011-08-05 07:03:21 +00:00
yugui 4270dbe629 Forward-ports r32777 from branches/ruby_1_9_3 to trunk.
--
* 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
2011-07-31 14:17:40 +00:00
tadf bc11aa72d3 * internal.h: added declarations.
* complex.c: followed the above change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-09 10:50:51 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* 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
2011-06-17 22:43:38 +00:00
tadf 14c504b3cc * complex.c (string_to_c_internal): uses rb_reg_nth_match;
* rational.c (string_to_r_internal): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-09 15:36:13 +00:00
tadf 6c81a8e44e * complex.c (string_to_c_internal): a refactoring.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-09 11:31:26 +00:00
mrkn ca927d60f4 * complex.c (string_to_c_internal): support scientific notation.
patched by Tinco Andringa. https://github.com/ruby/ruby/pull/16
  [ruby-core:36046][Bug #4655]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-09 04:52:57 +00:00
tadf 14491f13d7 * complex.c, rational.c: omitted some method calls.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-24 13:24:02 +00:00
akr b85ed255fa update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-08 10:51:14 +00:00
akr 02441dabf5 * complex.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-05 01:37:16 +00:00
tadf 4ffe7a1734 modified some descriptions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-23 14:28:55 +00:00
tadf 1d8ca7a237 * complex.c, rational.c ({nucomp,nurat}_expt): added a check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-22 22:31:55 +00:00
nobu dccf9e0c45 * configure.in, include/ruby/defines.h (RUBY_FUNC_EXPORTED): macro
to declare exported function.

* array.c (rb_ary_memsize), string.c (rb_str_memsize),
  variable.c (rb_objspace_data_type_memsize): used in
  objspace.  [ruby-dev:42022]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 06:33:06 +00:00
tadf bbb5a6d6f7 * complex.c (nucomp_to_[ifr]): don't allow complex with in-exact
imaginary zero to be converted.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-10 12:20:49 +00:00
nobu 5274f89201 * complex.c (nucomp_marshal_load): should check the argument.
[ruby-core:31622]

* rational.c (nurat_marshal_load): ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-05 09:36:16 +00:00
matz 95c6a8a3b7 * complex.c (nucomp_to_i): allow complex with imaginary zero to be
converted.

* complex.c (nucomp_to_f, nucomp_to_r): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-22 23:48:13 +00:00
nobu 062b4d6752 * include/ruby/{intern,io}.h: add missing prototypes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-22 03:02:40 +00:00
tadf a90469602c * complex.c, rational.c, lib/cmath.rb, lib/date.rb lib/date/delta*:
reverted r27484-27486.  now official spec.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-26 11:14:40 +00:00
tadf 3502114507 * complex.c, ratioanl.c: reverted experimental r24565.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-25 06:52:24 +00:00
naruse 27f953bfad * complex.c (f_signbit): remove condition for signbit because
all platforms have signbit from r26871.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-12 00:45:06 +00:00
naruse 556152ada3 * complex.c (m_log, m_exp): remove unused functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-04 01:16:37 +00:00
marcandre 215b8092a7 * complex.c (nucomp_real_check): raise TypeError instead of ArgumentError
when argument is not a real as expected [ruby-core:28395]

* rational.c (nurat_int_check): ditto (for integers)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-03 14:18:26 +00:00
naruse c942417791 * rational.c (nurat_expt): use Float#** when Rational ** Float.
This fixes Rational(3,1)**3.0=>26.99999999999999 on FreeBSD.

* complex.c (rb_fexpt): removed.
  Note that this function is not static but is private.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-25 02:26:22 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
nobu 31b7ae00c0 * include/ruby/st.h (st_hash_func): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:10:04 +00:00
tadf df21038777 * complex.c (nucomp_rationalize) added. [experimental]
* rational.c ({nurat,nilclass,integer,float}_rationalize) ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-16 23:17:14 +00:00
matz 9166dd9ec7 * numeric.c (num_imaginary): num#i to return imaginary counterpart
of the given numeric.

* complex.c (Init_Complex): undef #i for complex numbers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-16 22:28:48 +00:00
nobu d6ab828369 * complex.c (nucomp_hash), rational.c (nurat_hash): not to use
hash value of class so that equality against subclasses can
  work.  [ruby-dev:38850]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-25 04:44:36 +00:00
tadf a7290749a5 * complex.c (make_patterns): do not use \d.
* rational.c (make_patterns): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-19 11:43:23 +00:00
tadf 8d9896c3b9 * complex.c: added some shortcuts.
* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-12 14:57:42 +00:00
tadf 898bb1cbe3 * complex.c: use k_exact_{zero,one}_p macro.
* rational.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-12 12:09:21 +00:00
tadf fff1183ffe * numeric.c (fix_divide): added an entry to rational.
* rational.c (rb_rational_reciprocal): added.

	* complex.c (f_reciprocal): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-12 11:46:40 +00:00
tadf d43de333de * complex.c (nucomp_div): omitted zero division check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-08 14:18:02 +00:00
tadf b50cc1fe57 * complex.c (nucomp_s_polar): now arg is optional.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-05 13:46:10 +00:00
tadf 5a763bb525 * complex.c (float_arg): returns PI for -0.0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-05 11:44:34 +00:00
tadf e972280921 added examples.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-03 14:02:38 +00:00
tadf 0d2d098660 * complex.c (nucomp_equal_p): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-03 12:31:26 +00:00
tadf bac1841a93 * rational.c: renamed equal_p to eqeq_p.
* complex.c: ditto.

	* complex.c (nucomp_equal_p): added.
	  Complex(NaN).equal?(Complex(NaN)) should return true.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-03 12:19:54 +00:00
tadf b61ab11f49 * complex.c: undef-ed shome methods. [ruby-core:24110]
* complex.c (Numeric#arg): NaN for NaN.  [ruby-core:24116]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-03 10:50:17 +00:00
tadf 59a9da6443 * complex.c (nucomp_expt): do not use rb_fexpt.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-29 16:20:32 +00:00
tadf aa68d47b88 * complex.c (nucomp_expt): checks exactness.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-29 12:03:25 +00:00
tadf 0bd29ba216 * complex.c (nucomp_div): raises ZeroDivisionError immediately
when the given second argument is zero.

	* rational.c (nurat_fdiv): never raise even if the given second
	  argument is zero.

	* rational.c (rb_raise_zerodiv): changed the message (zero to 0).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-28 14:39:31 +00:00
tadf 268432c51d * complex.c (nucomp_expt): convert to a float when the given power
is a bignum.

	* rational.c (nurat_expt): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-28 13:27:48 +00:00
tadf f365778c26 * complex.c (nucomp_expt): some improvements.
* rational.c (nurat_expt): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-28 10:50:39 +00:00
tadf 53125214cc * complex.c: renamed some static functions.
* rational.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-28 00:22:07 +00:00
tadf ae96b225c4 trivial change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-27 10:35:17 +00:00
tadf 7cf1d66848 * complex.c (nucomp_addsub): new
* complex.c (nucomp_{add,sub}): use nucomp_addsub.

	* complex.c (nucomp_divide): changed the algorithm.

	* complex.c (nucomp_abs): added shortcuts.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-27 10:12:04 +00:00
tadf b2fb759624 * complex.c: revised rdoc.
* rational.c: ditto.

	* numeric.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-27 07:46:57 +00:00
tadf a05fd849a1 * complex.c: edited rdoc.
* numeric.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-20 11:29:21 +00:00
tadf 40d6a7527e * complex.c: edited rdoc.
* rational.c: ditto.

	* numeric.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 23:57:34 +00:00
tadf ab7baebb6d * complex.c: edited rdoc.
* rational.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 21:57:51 +00:00