aboutsummaryrefslogtreecommitdiffstats
path: root/rational.c
Commit message (Collapse)AuthorAgeFilesLines
...
* * marshal.c: experimental test aborted.tadf2012-06-031-44/+0
| | | | | | | | | * 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
* * marshal.c: calls directly rb_{Complex,Rational}_marshal_load().tadf2012-06-031-0/+20
| | | | | | | | | | 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
* use rb_marshal_{dump,load}nobu2012-06-031-8/+3
| | | | | | | | * 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
* * complex.c: wrote Complex#_dump and Complex::load. But nowtadf2012-06-031-0/+29
| | | | | | | | | 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
* * complex.c (nucomp_marshal_load): [ruby-core:45394]tadf2012-06-031-0/+4
| | | | | | | * rational.c (nurat_marshal_load): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_marshal_load): raise error on invalid data.naruse2012-02-251-0/+2
| | | | | | 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
* * use RB_TYPE_P which is optimized for constant types, instead ofnobu2011-09-291-5/+5
| | | | | | comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (nurat_coerce): Rational#coerce should converts itselfmrkn2011-08-171-0/+2
| | | | | | | | into Complex if the argument is a Complex with non-zero imaginary part. [Bug #5020] [ruby-dev:44088] * test/ruby/test_rational.rb (test_coerce): test for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: declare internal functions here.akr2011-06-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * 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
* * complex.c (string_to_c_internal): uses rb_reg_nth_match;tadf2011-06-091-10/+4
| | | | | | | | * rational.c (string_to_r_internal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (string_to_r): Rational#** may return flonum.tadf2011-06-091-3/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * insns.def (opt_mult): as r31805, volatile it.naruse2011-05-301-1/+1
| | | | | | | | | | Without this, clang -O fails calculation. * numeric.c (fix_mul): ditto. * rational.c (f_imul): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c, rational.c: omitted some method calls.tadf2011-04-241-19/+46
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c: parenthesize macro arguments.akr2010-12-261-14/+14
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* modified some descriptions.tadf2010-11-231-9/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c, rational.c ({nucomp,nurat}_expt): added a check.tadf2010-11-221-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * configure.in, include/ruby/defines.h (RUBY_FUNC_EXPORTED): macronobu2010-08-141-9/+1
| | | | | | | | | | | 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
* * rational.c (nurat_div): divided by infinity should be zero.nobu2010-08-061-8/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (nurat_div): divided by float zero should benobu2010-08-061-1/+1
| | | | | | | infinity. [ruby-core:31626] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_marshal_load): should check the argument.nobu2010-08-051-0/+1
| | | | | | | | | [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
* * bignum.c (rb_big_eq): never equal to infinity.nobu2010-08-031-0/+17
| | | | | | | | | [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
* * include/ruby/{intern,io}.h: add missing prototypes.nobu2010-07-221-0/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c, rational.c, lib/cmath.rb, lib/date.rb lib/date/delta*:tadf2010-04-261-0/+225
| | | | | | | | reverted r27484-27486. now official spec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c, ratioanl.c: reverted experimental r24565.tadf2010-04-251-225/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_real_check): raise TypeError instead of ArgumentErrormarcandre2010-03-031-1/+1
| | | | | | | | 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
* * rational.c (nurat_expt): use Float#** when Rational ** Float.naruse2010-02-251-3/+1
| | | | | | | | | 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
* fix typos.akr2009-11-031-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/st.h (st_hash_func): use st_index_t.nobu2009-09-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_rationalize) added. [experimental]tadf2009-08-161-0/+225
| | | | | | | | * 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
* * complex.c (nucomp_hash), rational.c (nurat_hash): not to usenobu2009-07-251-4/+3
| | | | | | | | 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
* * rational.c (float_to_r): an improvement.tadf2009-07-191-0/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (make_patterns): do not use \d.tadf2009-07-191-1/+1
| | | | | | | * rational.c (make_patterns): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: added some shortcuts.tadf2009-07-121-2/+28
| | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: use k_exact_{zero,one}_p macro.tadf2009-07-121-5/+8
| | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (fix_divide): added an entry to rational.tadf2009-07-121-0/+7
| | | | | | | | | * 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
* * rational.c: edited rdoc.tadf2009-07-051-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c: renamed equal_p to eqeq_p.tadf2009-07-031-14/+14
| | | | | | | | | | | * 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
* added a comment.tadf2009-06-291-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (float_to_r): always returns rational.tadf2009-06-291-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c (nucomp_div): raises ZeroDivisionError immediatelytadf2009-06-281-1/+3
| | | | | | | | | | | | | 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
* * complex.c (nucomp_expt): convert to a float when the given powertadf2009-06-281-1/+2
| | | | | | | | | | 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
* * complex.c (nucomp_expt): some improvements.tadf2009-06-281-5/+5
| | | | | | | | * rational.c (nurat_expt): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: renamed some static functions.tadf2009-06-281-10/+9
| | | | | | | | * rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * rational.c (nurat_cmp): use rb_num_coerce_cmp.tadf2009-06-271-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * complex.c: revised rdoc.tadf2009-06-271-354/+254
| | | | | | | | | | * rational.c: ditto. * numeric.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_div): don't use num_floor which is actuallytadf2009-06-201-123/+0
| | | | | | | | | | | | | | | | 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
* * 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