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

284 Коммитов

Автор SHA1 Сообщение Дата
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
nobu ef2c92ddf0 * numeric.c (flo_quo, int_round): added rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-05 06:41:40 +00:00
nobu 0cf0b0eed4 * numeric.c (round): added declaration. [ruby-dev:39222]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-04 11:40:58 +00:00
nobu 84255e0485 * vm_method.c (rb_remove_method_id): exported.
* numeric.c (num_sadded): fix for non-ascii method name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-27 09:31:11 +00:00
tadf 02a7cbec82 * numeric.c (flo_pow,fix_pow): may return complex number.
* bignum.c (rb_big_pow): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-16 23:03:45 +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
ko1 8e8e34319b * insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h: check
definition of (classes)#=== for case/when optimization.
  Fix Bug #1376 [ruby-core:23190].
* string.c (Init_String), bignum.c (Init_Bignum),
  numeric.c (Init_Numeric): define String#===, Symbol#===,
  Bignum#===, Fixnum#===, Float#=== as same as (classes)#==.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-12 05:55:06 +00:00
nobu 8dfd78fc1c * numeric.c (num_divmod): fixed rdoc. [ruby-core:24862]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-11 12:42:53 +00:00
matz 45cd729f17 * numeric.c (flo_hash): normalize -0.0 to 0.0. [ruby-core:24577]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-03 05:15:54 +00:00
nobu e07cb859cc * suppressed shorten-64-to-32 warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:05:32 +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
matz a82c5ee48b * numeric.c (dbl2ival): should raise FloatDomainError on Infinity
and NaN as 1.8 does.  [ruby-dev:38726]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-04 00:46:14 +00:00
tadf 426afe1e67 trivial changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-28 00:22:41 +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
matz 8a5ffe48e5 * numeric.c (int_chr): use default_internal encoding as default
destination encoding if set.  [ruby-dev:38717]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-26 18:18:12 +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 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
tadf d11b549104 * numeric.c: edited rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 14:44:03 +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
matz cdba56b38a * numeric.c (flo_cmp): should always return nil for NaN.
* numeric.c (flo_cmp): handle infinite value specially using
  infinite? method internally.  [ruby-dev:38681]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-19 08:19:14 +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 1fda5e1a3f * numeric.c ( num_numerator, num_denominator): use
to_r [ruby-core:23910].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-18 11:33:52 +00:00
matz 7fc9c4a4a0 * numeric.c (flo_cmp): Infinity is greater than any bignum
number.  [ruby-dev:38672]

* bignum.c (rb_big_cmp): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-17 17:05:31 +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
nobu 8e86bd59c0 * common.mk (bignum.o, numeric.o): depend on util.h.
* bignum.c, marshal.c: fixed types.

* numeric.c (infinite_value): use ruby_div0.

* include/ruby/util.h (ruby_div0): moved from marshal.c.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-26 04:58:15 +00:00
nobu 060f433f48 * include/ruby/ruby.h (rb_long2int, RARRAY_LENINT): check long to
cast to int.  [ruby-dev:38508]

* struct.c, vm_eval.c, vm_insnhelper.c: use RARRAY_LENINT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-20 16:43:41 +00:00
nobu 8ebd0d4320 * numeric.c (flo_to_s): reduce fragments if no precision lost.
c.f. [ruby-core:23075]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-06 16:08:23 +00:00
nobu a3a88c6bcd * file.c (sys_fail2, rb_file_s_readlink, BUFCHECK, rmext),
(rb_file_s_basename): get rid of overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-06 07:38:52 +00:00
nobu 1b71f8a53b * numeric.c (int_chr): checsk overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-06 06:11:57 +00:00
nobu d1abc53721 * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
  transcode_data.h, util.c, variable.c, vm_dump.c,
  include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
  suppress VC type warnings.  [ruby-core:22726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +00:00
nobu 080525aa68 * marshal.c (div0), numeric.c (infinite_value): new functions to
get rid of VC divion by 0 warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:09:15 +00:00
nobu 2e54fe9d4d * array.c, bignum.c, gc.c, numeric.c, string.c, util.c, insns.def,
missing/crypt.c, missing/vsnprintf.c, : suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-10 05:43:14 +00:00
nobu 9b52ae2e64 * numeric.c (flo_to_s): keeps enough precision for round trip.
[ruby-core:22325]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-05 09:36:39 +00:00
usa c691d55bcd * numeric.c (flo_eq, flo_gt, flo_ge, flo_lt, flo_le, flo_eql): revert
isnan() checks for VC++6.

	* insns.def (opt_lt, opt_gt): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-27 05:42:06 +00:00
matz 60e8b398cd * numeric.c (flo_eq): remove unnecessary NaN check using isnan().
comparison regarding NaN is false anyway.

* numeric.c (flo_gt, flo_ge, flo_lt, flo_le, flo_eql): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-23 17:15:17 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
nobu 367de8b97b * numeric.c (ruby_float_step): extracted from num_step().
* range.c (range_step): uses ruby_float_step() for float range.
  [ruby-dev:37691]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-04 02:58:45 +00:00
tadf 292d6ee99f * numeric.c: Infinity.numerator returns self. [experimental]
* numeric.c: Infinity.denominator returns 1. [experimental]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-29 12:23:55 +00:00
tadf 5d7f9f1721 arrangement
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-29 11:57:06 +00:00
akr a550f2992b * numeric.c (int_ord): Integer#ord implemented.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-22 12:32:11 +00:00
nobu 9f3b77e435 * configure.in (mingw): no longer uses snprintf and vsnprintf of
msvcrt.

* win32/win32.c (rb_w32_vsnprintf, rb_w32_snprintf): removed.

* win32/Makefile.sub (config.h): vsnprintf exists in VC7 or later.

* win32/mkexports.rb (Exports#initialize): aliases
  rb_w32_vsnprintf and rb_w32_snprintf for binary compatibility.

* sprintf.c (rb_str_format): uses snprintf instead of sprintf.

* numeric.c (flo_to_s, rb_num2long, rb_num2ll): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-22 03:05:20 +00:00
matz 90add5db45 * numeric.c (flodivmod): floating point division should raise
ZeroDivisionError as integer division. [incompatible]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-27 16:01:54 +00:00
matz 012fee9476 * numeric.c (num_step): treat infinite step specially.
[ruby-dev:37157] fix: #781.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-24 18:40:07 +00:00
matz 8705e3623c * numeric.c (num_sadded): remove newly defined singleton method
that should not exist after exception handling.  [ruby-dev:36569]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-18 10:39:41 +00:00
tadf 28a04df7bb fixed indentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-21 03:37:30 +00:00
yugui 396650e0bd * prec.c: removed. Precision will be redesigned and be back again.
c.f. [ruby-dev:36352].

* common.mk (COMMON_OBJS): removed prec.o.

* inits.c (rb_call_inits): removed Init_Precision.

* numeric.c (Init_Numeric): removed inclusion of Precision.
  removed #induced_from from each class.

* rational.c: ditto.

* ext/bigdecimal/bigdecimal.c: ditto.

* lib/rdoc/knwon_classes.rb: removed the entry for Precision.

* test/ruby/test_prec.rb: removed.

* test/ruby/test_integer.rb: removed tests for Precision.

* test/ruby/test_fixnum.rb: ditto.

* test/ruby/test_float.rb: ditto.

* test/ruby/test_rational.rb: ditto.

* test/ruby/test_complex.rb: ditto.

* test/bigdecimal/test_bigdecimal.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-19 13:10:54 +00:00
matz d7de44a8fc * dln.c: newer BeOS support. a patch from Pete Goodeve
<pete.goodeve at computer.org> in [ruby-core:18712].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-19 00:33:19 +00:00
tadf acde7364f7 * numeric.c: provides predicate real? instead of scalar?.
* complex.c: follows the above change.

	* lib/cmath.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-16 22:04:19 +00:00