Marcin Mielzynski
3/29/2006 7:42:00 PM
Daniel Berger wrote:
> Hi all,
>
> Ruby 1.8.4
>
> I realize there's a Fixnum#power! method defined in rational.rb, but it
> appears that Fixnum has that method available to it whether or not I
> require rational.rb. I looked through the Ruby source and didn't see
> anything.
>
numeric.c:
flo_pow(x, y)...
fix_pow(x, y)...
and then:
rb_define_method(rb_cFixnum, "**", fix_pow, 1);
rb_define_method(rb_cFloat, "**", flo_pow, 1);
and then in rational.rb:
class Fixnum
alias power! **
end
are You sure irb doesnt use rational.rb ?
lopex