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

118 Коммитов

Автор SHA1 Сообщение Дата
akr dd5ad24735 * rational.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-26 00:36:08 +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
nobu cba4d05785 * rational.c (nurat_div): divided by infinity should be zero.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-06 11:13:48 +00:00
nobu edd4332a38 * rational.c (nurat_div): divided by float zero should be
infinity.  [ruby-core:31626]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-06 11:12:35 +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
nobu 292c39098d * bignum.c (rb_big_eq): never equal to infinity.
[ruby-core:31603]

* rational.c (nurat_div): hack for integral float divisor.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-03 11:30:19 +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
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
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 bb45f1b2b8 * rational.c (float_to_r): an improvement.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-19 13:25:05 +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 2db8644039 * rational.c: edited rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-05 15:48:09 +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 51e70cae46 added a comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-29 11:33:52 +00:00
tadf 2b9df66146 * rational.c (float_to_r): always returns rational.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-29 11:31:03 +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 f94228c8bd * rational.c (nurat_cmp): use rb_num_coerce_cmp.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-27 07:58:15 +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 d82ed7e2c6 * numeric.c (num_div): don't use num_floor which is actually
flo_floor.

	* numeric.c (num_modulo): don't call '%'.

	* numeric.c (num_divmod): use num_modulo.

	* numeric.c: defined '%'.

	* rational.c (nurat_idiv,nurat_mod,nurat_divmod,nurat_rem): removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-20 12:37:13 +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
tadf 63f2557b56 * complex.c; edited rdoc.
* rational.c; ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 20:10:13 +00:00
tadf c21b9570dc * rational.c (nurat_abs); removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 19:31:41 +00:00
tadf ed0bdbc575 * rational.c; edited rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 13:59:08 +00:00
tadf f86ad72d2a due to conflict
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 13:37:04 +00:00
tadf 03f49cbb32 * complex.c: constant COMPLEX_NAME has been removed.
* rational.c: constant RATIONAL_NAME has been removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 11:47:53 +00:00
tadf a6e1a03e07 * rational.c: added rdoc. a patch from Run Paint Run Run.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 11:42:07 +00:00
tadf 5134783cde * numeric.c (*_numerator,*_denominator): moved to rational.c.
* rational.c (*_numerator,*_denominator): moved from numeric.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 00:31:08 +00:00
tadf 67f93ddc21 * rational.c (nurat_s_convert): calls to_r when the given argument
is non-integer.

	* rational.c (nurat_s_convert): raises TypeError when the given
	  argument is nil.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-18 13:41:44 +00:00
tadf cefaa1680c * rational.c (nurat_coerce): accepts Complex when the imag is
exact zero.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-17 14:49:10 +00:00
tadf b6849b2502 * bignum.c (rb_big_fdiv): checks whether the given second argument
can be converted to float properly.

	* numeric.c (fix_fdiv): calls rb_big_fdiv when the given second
	  argument is a bignum.

	* rational.c (nurat_fdiv): should calculate Float(x/y), not
	  Float(x)/Float(y).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-17 12:55:16 +00:00
tadf ad52268581 * complex.c (nucomp_coerce): accepts Complex instances.
* rational.c (nurat_coerce): accepts Rational
	  instances. [ruby-core:23859]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 23:17:17 +00:00
tadf 9540aa5b7b * complex.c (nucomp_fdiv): use fdiv recursively.
* complex.c (nucomp_expt): reduced code.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-13 22:57:02 +00:00
tadf 63721ea54e * rational.c (nurat_to_f): use fdiv.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-13 16:25:16 +00:00
mame e722ad99d5 * string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),
include/ruby/intern.h: add Murmurhash API.  [ruby-dev:37784]

* complex.c (nucomp_hash), array.c (rb_ary_hash), time.c (time_hash),
  string.c (rb_str_hsah), object.c (rb_obj_hash), range.c
  (range_hash), struct.c (rb_struct_hash), hash.c (rb_any_hash),
  rational.c (nurat_hash): use Murmurhash.  [ruby-dev:37784]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 19:55:34 +00:00
tadf c7e236efc1 * bignum.c (rb_cstr_to_inum): changed an error message.
* complex.c (string_to_c_strict): ditto.

	* rational.c (string_to_r_strict): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-29 14:26:16 +00:00