`3/2 = 1` is a consistent answer as long as the programmer understands modulo. The way you're phrasing it makes it sound like there are languages out there that say "`3/2 = 2` because 1.5 rounds up to 2".
just so long as you don't expect a consistent answer between python2.7 and 3.x... >.>
The phrasing is relatively clear to me as saying that some languages say 3/2 = 1.5 (e.g. JavaScript) and some languages say 3/2 = 1 (e.g. C).
Re:1/0 = 0
by std_throwaway on Friday August 10, 2018 @06:12PM
(#17737083)
Did you mean 2/3?
Re:1/0 = 0
by spooneybarger on Friday August 10, 2018 @06:15PM
(#17737096)
No. But most programming languages I know of return different results for 2/3 vs 2.0/3.0.
What does your favorite programming language return for 3/2 as compared to 3.0/2.0? Many will return different values.
EDIT:
for clarity of my point: integer math that uses machine types is pretty surprising compared to what we would expect from "math" in general for division.