Fun One Liners

Actually, it’s the / 2 that yields floats, the broadcasting dot does nothing here, since it’s pure scalar division.

There is no type stability issue, integer divided by integer gives a float, and that is perfectly predictable. The new code is float divided by float, which, predictably, gives a float.

Type instability means that the compiler is unable to predict the types in your code, because they can change based on the value of your inputs (as opposed to their types). So both of your expressions were type stable.

Edit: BTW, iseven only works for Integers not floats.

3 Likes