You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When y != 0 , the remainder r = x REM y is defined regardless of the
rounding mode by the mathematical relation r = x – y × n , where n is the
integer nearest the exact value x/y ; whenever |n – x/y| = ½ , then n is even.
Thus, the remainder is always exact. If r = 0 , its sign shall be that of x.
Precision control (4.3) shall not apply to the remainder operation.
What version of Go are you using (
go version
)?Go version is tip.
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
What did you do?
math.Remainder(-1,1)
https://play.golang.org/p/EZjSc56D0ax
What did you expect to see?
-0
What did you see instead?
0
Documentation for math.Remainder claims IEEE 754:
IEEE 754-1985 (the copy of the standard I could easily find) Section 5.1, second paragraph:
The cause of the bug is these lines in math/remainder.go:
Changing them to read:
fixes the bug, at least on amd64.
The text was updated successfully, but these errors were encountered: