aboutsummaryrefslogtreecommitdiffstats
path: root/rational.c
Commit message (Collapse)AuthorAgeFilesLines
...
* * complex.c: edited rdoc.tadf2009-06-191-23/+20
| | | | | | | | | | * rational.c: ditto. * numeric.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: edited rdoc.tadf2009-06-191-1/+7
| | | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c; edited rdoc.tadf2009-06-191-41/+22
| | | | | | | | * rational.c; ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (nurat_abs); removed.tadf2009-06-191-25/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c; edited rdoc.tadf2009-06-191-1/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* due to conflicttadf2009-06-191-110/+143
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: constant COMPLEX_NAME has been removed.tadf2009-06-191-5/+1
| | | | | | | | * 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
* * rational.c: added rdoc. a patch from Run Paint Run Run.tadf2009-06-191-2/+662
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (*_numerator,*_denominator): moved to rational.c.tadf2009-06-191-0/+60
| | | | | | | | * 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
* * rational.c (nurat_s_convert): calls to_r when the given argumenttadf2009-06-181-2/+5
| | | | | | | | | | | 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
* * rational.c (nurat_coerce): accepts Complex when the imag istadf2009-06-171-0/+4
| | | | | | | | exact zero. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_fdiv): checks whether the given second argumenttadf2009-06-171-1/+1
| | | | | | | | | | | | | | 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
* * complex.c (nucomp_coerce): accepts Complex instances.tadf2009-06-161-0/+2
| | | | | | | | | * 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
* * complex.c (nucomp_fdiv): use fdiv recursively.tadf2009-06-131-5/+5
| | | | | | | | * complex.c (nucomp_expt): reduced code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (nurat_to_f): use fdiv.tadf2009-06-131-81/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),mame2009-02-141-6/+11
| | | | | | | | | | | | 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
* * bignum.c (rb_cstr_to_inum): changed an error message.tadf2008-12-291-1/+1
| | | | | | | | | | * 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
* * rational.c: floor, ceil, truncate and round accept an extratadf2008-12-291-16/+71
| | | | | | | | argument like Float#round. [experimental] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: use rb_usascii_str_new2 instead of rb_str_new2.tadf2008-12-131-3/+3
| | | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_canonicalization): renamed.tadf2008-12-121-10/+5
| | | | | | | | | | | | | | * ext/math/complex.c: followed the above change. * rational.c (nurat_canonicalization): renamed. * ext/math/rational.c: followed the above change. * configure.in: defines a new macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c, rational.c: do not use RUBY_VERSION_CODE.tadf2008-12-121-5/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c, rational.c: do not use RUBY_VERSION_CODE.nobu2008-12-121-3/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: avoided warnings on cpp.tadf2008-12-101-0/+10
| | | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (nurat_{to_s,inspect}): performance improvement.tadf2008-12-051-9/+23
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: continues to support canonicalization *unofficially*tadf2008-10-281-3/+15
| | | | | | | | | | | | | for an odd library mathn for the time being (only 1.9.x). since grand mathn is must be very very special library for us. * rational.c: ditto. * ext/mathn/*/*: follow the above changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (Init_Complex), rational.c (Init_Rational): undefinesnobu2008-09-241-0/+1
| | | | | | | default #allocate methods which call the allocater. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (Init_Complex), rational.c (Init_Rational): ID_ALLOCATORnobu2008-09-241-12/+3
| | | | | | | differs from :allocate, and invisible in ruby level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_s_canonicalize_internal): does no applytadf2008-09-231-25/+13
| | | | | | | | | | | | | | canonicalization rule anymore. * rational.c (nurat_s_canonicalize_internal(_no_reduce)?): ditto. * complex.c: removed class method new! and new. * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: added two macros.tadf2008-09-211-4/+8
| | | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_s_convert): checks argc.tadf2008-09-211-4/+3
| | | | | | | | * rational.c (nurat_s_convert): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_s_canonicalize_internal): checks exactness oftadf2008-09-211-18/+15
| | | | | | | | | | | | | imag only. * rational.c (nurat_s_convert): accepts non real value (Rational(a,b) as a/b). * complex.c (nucomp_s_convert): refined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: an instance method image has been removed andtadf2008-09-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | uses "imag" instead of "image". * complex.c: two instance method re and im are removed. * rational.c: follows the above changes. * include/ruby/ruby.h: ditto. * gc.c: ditto. * lib/cmath.rb: ditto. * lib/mathn.rb: ditto. * lib/complex.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: uses f_(in)?exact_p macro.tadf2008-09-191-3/+6
| | | | | | | | | | | | | | | | | | | | | | | * rational.c: ditto. * bignum.c (rb_big_pow): bignum**bignum - should calculate without rational. * lib/complex.rb: should override Math module at most once. * lib/mathn.rb: requires 'cmath' directly. -この行以下は無視されます -- M complex.c M ChangeLog M lib/mathn.rb M lib/complex.rb M bignum.c M rational.c git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * prec.c: removed. Precision will be redesigned and be back again.yugui2008-09-191-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * complex.c (nucomp_s_convert): accepts complextadf2008-09-171-3/+1
| | | | | | | | value (Complex(a,b) as a+bi). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_marshal_{dump,load}): preserve instancetadf2008-09-161-1/+6
| | | | | | | | | | variables. * rational.c (nurat_marshal_{dump,load}): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c, include/ruby/ruby.h: rename rb_register_mark_object()ko12008-09-151-5/+5
| | | | | | | | | | | | | | to rb_gc_register_mark_object(). * eval.c, vm.c: initialize vm->mark_object_ary at Init_top_self(). * bignum.c, complex.c, encoding.c, ext/win32ole/win32ole.c, io.c, load.c, marshal.c, rational.c, ruby.c, vm.c: use rb_gc_register_mark_object() instead of rb_global_variable() or rb_gc_register_address(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fixed the previous commit.tadf2008-09-151-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_eql_p): new.tadf2008-09-151-2/+4
| | | | | | | | | | * complex.c (nucomp_hash): should use hash values of the elements. * rational.c (nurat_hash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: trivial changes.tadf2008-09-141-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (f_{add,mul,sub}): omitted some shortcuts for preservetadf2008-09-141-0/+6
| | | | | | | | | | signed zero anyway. * complex.c (nucomp_negate): new. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: refined.tadf2008-09-131-41/+53
| | | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: some adjustments.tadf2008-09-071-15/+30
| | | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c: removed unused code.tadf2008-09-071-4/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c: added a static variable for nurat_to_f.tadf2008-08-301-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c ({nucomp,numeric}_rect): new.tadf2008-08-291-32/+8
| | | | | | | | | | | | | | | | | | | | | | | * complex.c: added some aliases (::rectangular, ::rect, #rectangular, #rect, #phase, #magnitude). * complex.c (string_to_c_internal): should not strip any null bytes. * rational.c (string_to_r_internal): ditto. * rational.c (i_gcd): reverted to nurat 0.0.2's one. * numeric.c: added an alias (#magnitude). * test/ruby/test_complex.rb: added assertions. * test/ruby/test_rational.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_div): now behaves as quo.tadf2008-08-221-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * complex.c (nucomp_s_generic_p): has been removed. * complex.c (nucomp_to_s): adopts new form. * complex.c (nucomp_inspect): ditto. * complex.c (string_to_c_internal): ditto and supports polar form. * complex.c (rb_complex_polar): new. * rational.c (nurat_to_s): did not canonicalize. * rational.c (nurat_inspect): adopts new form. * rational.c (string_to_r_internal): ditto. * include/ruby/intern.h: added a declaration. * lib/complex.rb: added an obsolate class method. * lib/cmath.rb: use scalar? instead of generic?. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (rb_intern_const): tiny optimization.nobu2008-08-161-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * sprintf.c: include ieeefp.h to refer isinf.mame2008-07-021-0/+4
| | | | | | | | | | | * ext/bigdecimal/bigdecimal.c: ditto. * ext/json/ext/generator/generator.c: ditto. * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (nurat_equal_p): Rational(0,x) and 0 are equivalent,tadf2008-06-131-0/+6
| | | | | | | | anyway. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e