SQLite Forum

Fail to calculate long expression
Login
Read it again. It's not the *result* that is truncated, it's the *operands*, before the modulo operation happens. So SQLite computes 8 mod 0, which becomes a NULL.

As to *why* it does that, it is probably a decision made such a long time ago nobody remembers anymore. It can't easily be changed now, for backwards compatibility. I suppose such a change could be made, with a suitable pragma to turn on the new behaviour, but then you had to make a strong case for that.