I'd rather retain the dwimmishness of p5. $ perl -MMath::Complex -le 'print sqrt(-1)' i
Note that I didn't have to pass in Math::Complex->make(-1,0). Just -1. On 11/20/08, Chris Dolan <[EMAIL PROTECTED]> wrote: >> Mark (>): >>> I think the most sensible thing is to be consistent. sgn() fails for >>> non-real input as long as sqrt() returns NaN for negative input. >>> Change the latter behavior (via a pragma or whatever) so that sqrt() >>> returns complex numbers, and then sgn() should start behaving on such >>> numbers. >> >> I like that. Both sign() and sqrt() will then behave like they usually >> do, without complex surprises. But for those who want the generalized >> behvaiour, it's only a pragma away. >> >> // Carl > > Rather than a pragma, wouldn't it make more sense to have > > multi sub sgn(Num) -> Num > multi sub sqrt(Num) -> Num > > behave appropriately for real numbers and > > multi sub sgn(Complex) -> Complex > multi sub sqrt(Complex) -> Complex > > behave appropriately for complex numbers? So people who want sqrt(-1) be > return i must pass in Complex.new(-1,0) or whatever the right syntax is. > > > -- Sent from Gmail for mobile | mobile.google.com Mark J. Reed <[EMAIL PROTECTED]>