Real, mathematical "modulo" operation in Postgres? SELECT MOD(24 + MOD(-2, 24), 24); will return 22 instead of -2