KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
From the haskell report: The quot, rem, div, and mod class methods satisfy these laws if y is non-zero: (x `quot` y)*y + (x `rem` y) == x (x `div` y)*y + (x `mod` y) == x quot is integer division truncated toward zero, while the result of div is truncated toward negative infinity. For example: Prelude> (-12) `quot` 5 -2 Prelude> (-12) `div` 5 -3 What are some examples of where the difference between how the result is truncated matters?
Tags (comma-separated)
Save Edits
Cancel