SQLite Forum

Math functions for arguments outside the domain should raise exception according to SQL Standard
Computing systems like Matlab, Python, Julia, ... do raise an exception for expressions like `log(-1)` even if returning a complex value in principle would be an option (one needs to use `log(-1+0i)` to avoid the exception). But these systems do also provide mechanisms to catch exceptions. The SQL standard is short-sighted in the sense that if raising exceptions is specified then also an SQL catch mechanism should have been provided. Therefore I find a non-compliance of Sqlite here acceptable.

Mathematical analytic continuation is not very useful if the value in question represents a real world parameter such as a density or temperature. When measuring such parameters, impossible negative values can occur for various reasons (instrumental offsets, noise, ...) and must be dealt with in the data processing. A good strategy is to check the value before functions like log are called, and then conditionally do something appropriate.