# fix f128 remainder division bug · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/eb6a8e6a3bba061c4a7fb18f53976e1fb683c3d4)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: eb6a8e6a3bba061c4a7fb18f53976e1fb683c3d4

Requested commit: eb6a8e6a3bba061c4a7fb18f53976e1fb683c3d4

Commit: eb6a8e6a3bba061c4a7fb18f53976e1fb683c3d4

Tree: 137d90a657f1b6fe178f4eba4436c7ebfa2638b0

Author: Ben Noordhuis

Committer: Andrew Kelley

## Message

```
fix f128 remainder division bug

The modulo operation computed rem(b+rem(a,b), b) which produces -1
for a=1 and b=2.

Switch to a - b * trunc(a/b) which produces the expected result, 1.

closes #1137

```

## Parents

- [4eca75c53b4679e7e31df1505d22a5b618a2d797](https://git.cafe/gitcafe/zig/commit/4eca75c53b4679e7e31df1505d22a5b618a2d797?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/eb6a8e6a3bba061c4a7fb18f53976e1fb683c3d4?format=markdown)
