Skip to content

[#319] Handle exception case of euclidean division in Michelson style

Alyona Antonova requested to merge alyoanton9/#319-handle-natural-numbers into master

Description

Euclidean division operation divMich a b performs division of a and b incorrectly when mod a b == 0. It was described in one MR that integer division performances differ in Michelson and in Haskell. So when divisor is negative and divisible number is multiple of divisor, the results are equal in Michelson and in Haskell.

As a solution we need to handle this case in divMich and don't change the result of div if mod a b == 0.

Related issue(s)

Resolves #319 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • [x]I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Merge request reports