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

go语言的除法 #27

Open
wuyongxiu opened this issue Apr 18, 2017 · 0 comments
Open

go语言的除法 #27

wuyongxiu opened this issue Apr 18, 2017 · 0 comments

Comments

@wuyongxiu
Copy link
Owner

go语言的数学操作定义

Arithmetic operators apply to numeric values and yield a result of the same type as the first operand.

所以在go语言里

3/10=0 (3和10是int型)

3.0/10.0=0.3 (3.0和10.0是浮点型)

float64(3)/float64(10)=0.3

参考: http://stackoverflow.com/questions/32815400/how-to-perform-division-in-golang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant