complex numbers

Anno Siegel anno4000 at lublin.zrz.tu-berlin.de
Tue Jan 11 18:59:17 CET 2005


It's me <itsme at yahoo.com> wrote in comp.lang.perl.misc:

[reply moved to bottom into context]

> "Jürgen Exner" <jurgenex at hotmail.com> wrote in message
> news:Fm6Ed.3556$u47.321 at trnddc09...
> > xah at xahlee.org wrote:
> > > #python supports complex numbers.
> > [...]
> >
> > So?
> >
> 
> The world would come to a halt if all of a sudden nobody understands complex
> numbers anymore.  :-)
> 
> > > # Perl doesn't support complex numbers. But there are packages that
> > > supports it.
> >
> > The Math::Complex module is part of the standard installation already, no
> > need for any "packages" (whatever that might be).
> > Did you check "perldoc Math::Complex"
> >
> > NAME
> >     Math::Complex - complex numbers and associated mathematical functions
> > [...]

> For those of us that works with complex numbers, having complex number as a
> natively supported data type is a big advantage.  Non-native add-ons are not
> sufficient and lead to very awkward program code.

Like this?

    use Math::Complex;

    my $z = sqrt( -1);
    print 1 + $z, "\n"; # prints "1+i"

Operator overloading makes it possible to work with complex numbers as if
they were a native data type.

Anno




More information about the Python-list mailing list