Should we tweak the integer division example in Freelancer Rates introduction?
kytrinyx opened this issue · 2 comments
The introduction says:
Integers and floats can be mixed together in a single arithmetic expression. Using a float in an expression ensures the result will be a float too.
The example used is 6 / 3
, showing that the result is a float. Would it be worth using 5 / 2
as the example, to further emphasize how this is different for people coming from languages who return an integer here?
I'd be happy to submit a PR if this seems like a good change.
The introduction that I am reading says something different. 6 / 3
isn't used as an example of
the paragraph you're quoting, but as an example for the next paragraph that describes an exception.
First, an example of two different kinds of multiplications are shown to drive down the point that using a float will cause the result to be a float: 2 * 3 # => 6
and 2 * 3.0 # => 6.0
.
Then it says that that property doesn't apply to division, division will always return a float. Hence the example of 6 / 2 # => 3.0
, because most people would expect 6 / 2 # => 3
. Changing that example to 5 / 2 # => 2.5
wouldn't be an improvement because fewer people expect 5 / 2
to produce an integer than 6 / 2
.
Does that make sense? Or are we somehow talking about different documents?
No, I think we're talking about the same document, I just probably quoted the wrong part.
I would have expected 5 / 2
to produce 2
, but if I'm an outlier then I think that this documentation should remain as it is.
Thank you so much for discussing! ❤️