Comment 3 for bug 552413

Revision history for this message
Matt Giuca (mgiuca) wrote :

Actually, rem isn't correct either. This needs to be plain stupid integer truncation -- i.e., MAX_INT and MIN_INT should be preserved, MAX_INT+1 should map to MIN_INT, and MIN_INT-1 should map to MAX_INT.

There doesn't appear to be a function in Mercury for converting an integer to an int with truncation (filed bug #141 with Mercury). In the meantime, write one.