http://guide.elm-lang.org/core_language.html says
Unlike JavaScript, Elm makes a distinction between integers and floating point numbers. Just like Python 3, there is both floating point division (/) and integer division (//).
> 9 / 2
4.5
> 9 // 2
4
The comparison to python is slightly confusing because:
- semantics are not the same. which is ok as these are different languages
- python supports the
//
operator on Floats while elm does not
> 18 / 7
2.5714285714285716 : Float
> 18 // 7
2 : Int
> 18.0 // 7.0
-- TYPE MISMATCH --------------------------------------------- repl-temp-000.elm
The left argument of (//) is causing a type mismatch.
3| 18.0 // 7.0
^^^^
(//) is expecting the left argument to be a:
Int
But the left argument is:
Float
Hint: Elm does not automatically convert between Ints and Floats. Use `toFloat`
and `round` to do specific conversions.
<http://package.elm-lang.org/packages/elm-lang/core/latest/Basics#toFloat>
in python:
>>> 18 / 7
2
>>> 18 // 7
2
>>> 18.0 / 7.0
2.5714285714285716
>>> 18.0 // 7.0
2.0