Question: Integer division in CO always rounds its result towards zero. In particular -9/2 is equal to -4. In other languages instead, the division always rounds

Integer division in CO always rounds its result towards zero. In particular -9/2 is equal to -4. In other languages instead, the division always rounds towards infinite. In this case, -9 divided by 2 is equal to -5. In this case the division is called the quotient and the associated modulus is called remainder. Let's suppose we want to implement this convention: you need to write two CO functions quotient and remainder with the following property: quotient(x,y)*y + remainder(x,y) == x; for all ints x and y unless quot overflows. Put the correspondig contracts in a file, and test them in Coin.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!