I'd like to implement overflow checking for Int arithmetic, so that overflow causes ArithmeticException (or platform equivalent) rather than giving an incorrect result.
The exception would be wrapped in sys::Err, same as for division by zero:
$ fansh
Fantom Shell v1.0.61 ('?' for help)
fansh> 1/0
sys::Err: java.lang.ArithmeticException: / by zero
I don't think that makes sense for Fantom because a) its too high a performance penalty and b) all ints in Fantom are 64-bit which makes overflow a low probability
StephenViles Sun 5 Feb 2012
I'd like to implement overflow checking for Int arithmetic, so that overflow causes ArithmeticException (or platform equivalent) rather than giving an incorrect result.
The exception would be wrapped in
sys::Err
, same as for division by zero:The implementation would be based on the MathUtils class in @jodastephen's ThreeTen project, and the Google Guava project's math utilities class LongMath.
Thoughts?
brian Sun 5 Feb 2012
I don't think that makes sense for Fantom because a) its too high a performance penalty and b) all ints in Fantom are 64-bit which makes overflow a low probability