3 ms·
> Instead of barfing when assigning a Float to an Int, just auto round? Rounding involves a loss of data. If an operation would result in data loss, that opera
by JohnFen 3y ago
> Instead of barfing when assigning a Float to an Int, just auto round?
Rounding involves a loss of data. If an operation would result in data loss, that operation should not be automatic. It should only be possible by the dev intentionally choosing it.
- throwawaymaths 3y agoTechnically float + float can result in data loss.
- JohnFen 3y agoTrue, but that's a case where you're doing it on purpose by choosing to do floating point math, where that's standard behavior. That's a bit different than data loss resulting from an assignment operation, where data loss is not standard behavior.