jstolarek / slicer

Companion code for paper "Imperative Functional Programs that Explain their Work", Wilmer Ricciotti, Jan Stolarek, Roly Perera and James Cheney, ICFP 2017, Oxford, UK
http://dl.acm.org/citation.cfm?id=3110258
GNU General Public License v3.0
6 stars 0 forks source link

Numerical overflows #56

Closed jstolarek closed 7 years ago

jstolarek commented 7 years ago

Integer arithmetic in iTML is prone to numerical overflows:

$ slicer --repl
Welcome to Slicer REPL
slicer> 1 + 1000000000000000000000000000000
val it = 5076944270305263617 : int

An easy solution would be to internally rely on Integer rather than on Int. An alternative solution would be to catch overflows and raise an exception. The former seems much easier.

jstolarek commented 7 years ago

Fixes on js-doubles.