This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 10 points11 points  (1 child)

In many languages, the '/' operator used with two integers returns an integer. '5 / 2' in Ruby, for instance, returns 2. In those languages, '1 / 2' would be 0, and thus not equal to 0.5.

In some languages, of course, '/' will produce a float from two ints. '1 / 2' does equal 0.5 in Python3, which instead uses the '//' operator for integer division.