# Complex(-4.0,0.0)\*\*(Complex(1.0/2,0.0)) with mathn

**URL:** <https://www.ruby-forum.com/t/complex-4-0-0-0-complex-1-0-2-0-0-with-mathn/137079>\
**Category:** Development\
**Created:** [May 8, 2008, 7:46pm UTC](https://www.ruby-forum.com/t/complex-4-0-0-0-complex-1-0-2-0-0-with-mathn/137079 "2008-05-08T19:46:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanaka\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Post date:** [May 8, 2008, 7:46pm UTC](https://www.ruby-forum.com/t/complex-4-0-0-0-complex-1-0-2-0-0-with-mathn/137079/1 "2008-05-08T19:46:35Z")

</div>

1.8 e$B$Ge(B mathn e$B$r;H$C$Fe(B -4 \*\* (1/2) e$B$re(B (Float e$B$Ge(B)  
e$B7W;;$9$k$He(B  
NaN e$B$K$J$k$s$G$9$,$=$&$$$&$b$N$G$7$g$&$+!#e(B

% ./ruby -rmathn -ve ‘p Complex(-4.0,0.0)\*\*(Complex(1.0/2,0.0))’  
ruby 1.8.7 (2008-05-07 patchlevel 5000) [i686-linux]  
/home/akr/ruby/18/lib/ruby/1.8/rational.rb:442: warning: method  
redefined; discarding old numerator  
/home/akr/ruby/18/lib/ruby/1.8/rational.rb:449: warning: method  
redefined; discarding old denominator  
/home/akr/ruby/18/lib/ruby/1.8/rational.rb:470: warning: method  
redefined; discarding old gcd  
/home/akr/ruby/18/lib/ruby/1.8/rational.rb:489: warning: method  
redefined; discarding old lcm  
/home/akr/ruby/18/lib/ruby/1.8/mathn.rb:110: warning: discarding old /  
/home/akr/ruby/18/lib/ruby/1.8/mathn.rb:114: warning: discarding old /  
/home/akr/ruby/18/lib/ruby/1.8/mathn.rb:120: warning: method redefined;  
discarding old inspect  
/home/akr/ruby/18/lib/ruby/1.8/mathn.rb:233: warning: method redefined;  
discarding old sqrt  
NaN

mathn e$B$8$c$J$/$Fe(B complex e$B$J$ie(B NaN e$B$K$O$J$j$^$;$s!#e(B

% ./ruby -rcomplex -ve ‘p Complex(-4.0,0.0)\*\*(Complex(1.0/2,0.0))’  
ruby 1.8.7 (2008-05-07 patchlevel 5000) [i686-linux]  
Complex(1.22460635382238e-16, 2.0)

---

<div class="post-metadata">

**Author:** ![Tanaka\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Post date:** [May 12, 2008, 1:34pm UTC](https://www.ruby-forum.com/t/complex-4-0-0-0-complex-1-0-2-0-0-with-mathn/137079/2 "2008-05-12T13:34:24Z")

</div>

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev :34622] the message: "[ruby-dev:34622]  
Complex(-4.0,0.0)\*\*(Complex(1.0/2,0.0)) with mathn ", on May/09  
02:46(JST) Tanaka A. writes:

> 1.8 e$B$Ge(B mathn e$B$r;H$C$Fe(B -4 \*\* (1/2) e$B$re(B (Float e$B$Ge(B) e$B7W;;$9$k$He(B  
> NaN e$B$K$J$k$s$G$9$,$=$&$$$&$b$N$G$7$g$&$+!#e(B

e$B$$$(e(B. e$B$=$&$$$&$b$N$G$O$J$$$G$9e(B.

> % ./ruby -rmathn -ve ‘p Complex(-4.0,0.0)\*\*(Complex(1.0/2,0.0))’

> % ./ruby -rcomplex -ve ‘p Complex(-4.0,0.0)\*\*(Complex(1.0/2,0.0))’  
> ruby 1.8.7 (2008-05-07 patchlevel 5000) [i686-linux]  
> Complex(1.22460635382238e-16, 2.0)

mathne$B$r%m!\<%I$7$F$$$k$He(B.

Complex(-4.0,0.0) # =\> -4.0

e$B$K$J$je(B, e$B$=$N$^$^e(B  
Floate$B$H$7$Fe(B\*\*e$B$r7W;;$9$k$3$H$,860x$G$9e(B.

e$B0JA0$Oe(B, complex.rb e$B$Ge(B {Fixnum,Bignum,Float}#\*\*  
e$B$r:FDj5A$7$F$$$?$N$Ge(B,  
e$B$3$N$^$^$G$bF0:n$7$F$$$?$N$G$9$,e(B,  
complex.rbe$B$G$N:FDj5A$r$d$a$?$H$-$Ke(B, mathn.rb  
e$B$GBe$j$NBP1~$r$7$J$/$F$Oe(B  
e$B$$$1$J$$$3$H$K5$$,IU$$$F$$$^$;$s$G$7$?e(B.

e$B$I$&$9$k$Y$-$+9M$($F$\_$^$9e(B.

\_\_  
----------------------------------------------------\>\> e$B@PDMe(B  
e$B7=\<ye(B \<\<—  
----------------------------------\>\> e-mail: removed\_email\_address@domain.invalid \<\<—
