If a programmer calls a function with an argument that has a well-established type, s/he may very well expect a result according to that type, (considering that overloading isn't just a word for not caring about type).
So, calling sqrt with a real < 0, should not come back with a complex number. Calling sqrt with a complex z where Re(z) < 0 and Im(z)=0 should return a complex number. Calling sgn() with a complex - why not give me what I'm (obviously) asking for? On Thu, Nov 20, 2008 at 4:31 PM, Carl Mäsak <[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 >