Which division should I choose for integer rings: rounded or truncated?

61 Views Asked by At

I am coding a library with other math students like me where we play around with the conceps we are learning in Algebra I course. You can find it on GitHub: Algebra_I

Currently I am building a class (an object, a piece of code so to speak) to represent quadratic integer rings (Wikipedia) and I want to implement the division between elements of such rings. The problem is there is no unique division in this case, so I'll have to stick with one.

Let's start with this example: Example division picture

And another, simple integer example: 3 / 5

  • One option would be to perform truncated integer divisions:

    Truncated division picture

    This way the quotient would be 0 + 0i = o and the remainder, -1 + 11i. As for the simple integer example, the quotient would be 0 and the remainder, 3.

    PROS: It's intuitive for coders and what users (classmates) might expect.

  • The other option I have come up with would be to perform rounded integer divisions:

    Rounded division picture

    This way the quotient would be 0 + i and the remainder, 9 + i. As for the simple integer example, the quotient would be 1 and the remainder, -2.

    PROS: The remainders are the smallest possible (their norms are).

    CONS: Its integer equivalent is non euclidean (negative remainders).

Which of these two divisions makes more sense or is more useful? Can you come up with a better option?

Thanks beforehand and Happy New Year :).