Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime % result in less zeros values #40004

Closed
MasterDimmy opened this issue Jul 2, 2020 · 2 comments
Closed

runtime % result in less zeros values #40004

MasterDimmy opened this issue Jul 2, 2020 · 2 comments

Comments

@MasterDimmy
Copy link

@MasterDimmy MasterDimmy commented Jul 2, 2020

What version of Go are you using (go version)?

$ go version
 go1.14.4 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
AMD64
Windows

What did you do?

fmt.Printf("x=%d", (115-303)%1626)

output:
x=-188

https://play.golang.org/p/yYVbpJYbp-L

What did you expect to see?

x=1438

What did you see instead?

x=-188

Reminder by module deviding cant be less zero !

@randall77
Copy link
Contributor

@randall77 randall77 commented Jul 2, 2020

This is as specified in the spec: https://golang.org/ref/spec#Arithmetic_operators

@randall77 randall77 closed this Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.