• mtassin (8/8/2008)

    The Square Root of -1 is i, which is an imaginary/complex number. It cannot be returned as a float data type because it is out of the domain of the float data type.

    Mark, your argument assumes that the reader knows that the result of passing a negative parameter to the function results in an answer that is out of range or of the wrong data type. For instance, if I typed SELECT SQRT(-23) and I got the error "a domain error occurred", how would I know that this is wasn't because I used an odd number rather than because I used a negative number? I totally agree with you that this behaviour is correct: I'm just saying that I think the range of permissible values should be documented in Books Online. Look at the documentation for the ASIN function, for how it should be done:

    float_expression

    Is an expression of the type float or of a type that can be implicitly converted to float, with a value from -1 through 1. Values outside this range return NULL and report a domain error.

    By the way, I was fooled by the @b-2 thing, just like James. I read "negative" instead of "non-negative" and so I immediately discounted the correct answer!

    John