aboutsummaryrefslogtreecommitdiffstats
path: root/rational.c
Commit message (Collapse)AuthorAgeFilesLines
* * 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
* * complex.c (string_to_c, nucomp_s_convert): preserve the currenttadf2008-06-131-8/+17
| | | | | | | | | | | | backref. * rational.c (string_to_r, nurat_s_convert): ditto. * include/ruby/intern.h (rb_match_busy): added a declaration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (string_to_r_internal): save and restore backref. fixed ↵wanabe2008-06-131-1/+5
| | | | | | [ruby-dev:34990] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: refactoring.tadf2008-06-121-90/+38
| | | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (nurat_s_convert): need not to initialize optionalmatz2008-06-101-2/+0
| | | | | | argument for rb_scan_args(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fixedtadf2008-06-091-2/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_s_convert): can accept Complex('i').tadf2008-06-091-16/+14
| | | | | | | | [ruby-dev:34991] and some minor changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.nobu2008-06-091-0/+2
| | | | | | | * *.c: no cache in init functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (make_patterns): constified.nobu2008-06-091-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (make_patterns): constified.nobu2008-06-091-4/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (string_to_r_internal): use rb_isdigit.naruse2008-06-011-1/+1
| | | | | | | | * marshal.c (long_toobig): use %zd. * ruby.c (set_arg0): move unused variable definition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_fdiv): flo.fdiv(NaN) should result NaN.matz2008-05-071-22/+18
| | | | | | | | | | | | | | * numeric.c (num_quo): renamed and moved from bignum.c. [ruby-dev:34582] * bignum.c (rb_big_fdiv): update RDoc description * rational.c (nurat_s_new_m): small refactoring. * bignum.c (rb_big2dbl): no need for forceful warning when converting to float. overflow is a nature of float values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_parse.rb (TestParse::test_void_expr_stmts_value):matz2008-05-011-2/+2
| | | | | | | | | shut up warning. * rational.c (nurat_to_f): no need for forceful warning when converting to float. overflow is a nature of float values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational (nurat_marshal_load): checks the giventadf2008-04-281-9/+14
| | | | | | | | denominator. [ruby-dev:34536] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (nurat_expt): use f_rational_new2. [ruby-dev:34524]tadf2008-04-271-5/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c, rational.c: fixed indent.nobu2008-04-221-119/+132
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/cmath.rb: new.tadf2008-04-051-4/+3
| | | | | | | | | | | | * 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
* * bignum.c (Init_Bignum): rdiv method removed. [ruby-dev:34242]matz2008-04-031-19/+2
| | | | | | | | | | | | * complex.c (nucomp_quo): ditto. * numeric.c (num_rdiv): ditto. * rational.c (nurat_div): ditto. * complex.c (nucomp_fdiv): fdiv implementation restored. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_int_check): function for DRY real check.tadf2008-04-031-3/+3
| | | | | | | | * complex.c (nucomp_{add,sub,mul,div,expt}): use rb_num_coerce_bin(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_rdiv): should always return rational number.matz2008-04-021-33/+31
| | | | | | | | | | | * rational.c (nurat_add, nurat_sub, nurat_mul, nurat_fdiv, nurat_cmp): use rb_num_coerce_bin(). * rational.c (nurat_division): does / and rdiv. * .gdbinit (rp): no longer use rb_p(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (nurat_int_check): function for DRY integer check.matz2008-04-021-54/+19
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c: need to include <float.h> just once.matz2008-04-011-4/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* adopted the ruby's style.tadf2008-03-311-989/+999
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert.tadf2008-03-311-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_quo): should convert its operand to Rational.matz2008-03-311-1/+1
| | | | | | | | | * rational.c (string_to_r_strict): should raise TypeError. * bignum.c (Init_Bignum): should not redefine Bignum#div. Numeric#div will do. [ruby-dev:34066] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (f_lcm): removed.tadf2008-03-271-22/+73
| | | | | | | | | | | | * rational.c (rb_lcm, rb_gcdlcm): added. * lib/complex.rb (gcd, lcm, gcdlcm): removed. * lib/rational.rb (gcd, lcm, gcdlcm): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* trivial changes.tadf2008-03-241-55/+55
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fixed. [ruby-dev:34109]tadf2008-03-221-19/+19
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rearrangement.tadf2008-03-201-5/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (nurat_to_f): C99.nobu2008-03-201-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* improvements.tadf2008-03-201-68/+549
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* added rb_gcd.tadf2008-03-191-0/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert.tadf2008-03-191-19/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_to_s, nucomp_inspect): get rid of makingnobu2008-03-191-16/+19
| | | | | | | | | | | | unnecessary intermediate objects. * complex.c (make_patterns, string_to_c): do not treat successive underscores as a part of numeric like as literals. [ruby-dev:34085] * rational.c (make_patterns, string_to_r): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* edited comments.tadf2008-03-161-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* both complex and rational are now builtin classes.tadf2008-03-161-0/+1111
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e