in reply to Constructing complex numbers using recursion

Do you use use warnings; use strict? As it stands, and ignoring the gratuitous blah stuff, this is broken code. On the face of it $real = @constructPolar[0]; is not valid. There are other similar problems.

Try to put together an example that can actually be run and demonstrates the problem.


Perl is Huffman encoded by design.

Replies are listed 'Best First'.
Re^2: Constructing complex numbers using recursion
by moltar512 (Sexton) on Nov 08, 2005 at 04:36 UTC
    oh ya, i do use warnings and strict
    you guys have yelled at me about that before ;)

    checking my code, i do have $real = $constructPolar[0].. my mistake

    My code is really really long.. haha..
    this is the general idea of what it is doing.. without the stuff I marked as interesting it is working okay. I figured there might be a weird reason i couldn't just do recursion like i was trying to. I don't think it should infinitely loop.. i don't see how it could.. but it doesn't make any sense why it should make my system hang when i try to run/compile it

      Where do $isinPolarForm, $isinRectForm get set?


      Perl is Huffman encoded by design.
        $isinPolarForm are flags

        In the actual program:
        #if value1 is in polar form if(rindex($value1, "_") > 0) { $value1isRectangular = 0; $magnitude1 = substr($value1, 0, index($value1, " ")); $angle1 =substr($value1, (rindex($value1, " ") + 1), length($v +alue1)); #@constructedvalue1Polar = &constructComplex(&PolarToRect($val +ue1)); #$real1 = $constructedvalue1Polar[0]; #$complex1 = $constructedvalue1Polar[2]; }