SQLite Forum

Math functions for arguments outside the domain should raise exception according to SQL Standard
I compared SQLite implementation of the math functions to the SQL Standard and other RDBMS, and I found one issue.

The SQRT(-1) and LN(-1) functions return NULL, but SQL Standard says they should raise an error. It is implemented according to the SQL Standard in PostgreSQL, Oracle and SQL Server.

> If <natural logarithm> is specified, then let V be the value of the simply contained <numeric value expression>.

> Case:

> 1) If V is the null value, then the result is the null value.
> 2) If V is 0 (zero) or negative, then an exception condition is raised: data exception — invalid argument for natural logarithm.
> 3) Otherwise, the result is the natural logarithm of V.

Source: page 282 in "Part 2: Foundation" of SQL:2011 draft.
Note: I have access only to SQL:2011 draft. It is available in [https://www.wiscorp.com/sql20nn.zip](https://www.wiscorp.com/sql20nn.zip) archive linked on the [https://www.wiscorp.com/SQLStandards.html](https://www.wiscorp.com/SQLStandards.html) page.

SQLite returns NULL also for example for ACOS(2), so there can be similar issue, however it isn't described by the SQL:2011 draft.

Is there a reason why SQLite returns NULL instead of raising an error?