SQLite Forum

Math functions for arguments outside the domain should raise exception according to SQL Standard
Login
Actually, the question is which definition of 'the reals' is it using. For the true mathematical reals, sqrt(-1) is a domain error, so an error message would be appropriate.

Only when you extend the reals to add the Not-a-Number value, can you include that in the possible results. Since SQL predates the IEEE-754 definition for floating-point representations, which is as far as I know the origin of the NAN value, at least as far as a general definition. it isn't surprising that it adopted some conventions that disagree with the later standard.