The reason that the computation fails is how SQLite handles the modulo operator **%**. The SQLite documentation describes the operator as follows: > The % operator casts both of its operands to type INTEGER and then computes the remainder after dividing the left integer by the right integer. So, as soon as the right operand is smaller than `| 1 |` it is truncated to `0`, and alas a division by zero takes place, resulting in a NULL value. In your long expression you have the subexpression `617%29%(operand) = 617%29%(-0.0317193865612212)`. That is, the third operand in this partial expression will be truncated to 0, and you have `617%29%0 = 8%0 = NULL`. And this forces the whole expresssion to become NULL.