Golang’s math.Mod(10, 4) returns 2 — ie. the integer part of division result 2.5 — but shouldn’t it be “the floating point remainder”, that is, 0.5?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The result is correct. math.Mod returns the remainder, which really is 2 in this case. It’s equivalent to the % operator, but for floating point numbers.