munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
8.42k stars 1.01k forks source link

update guidance around division by zero #1153

Open jeremyhuiskamp opened 5 months ago

jeremyhuiskamp commented 5 months ago

Ruby doesn't throw an exception when dividing by 0.0, which is the equivalent to dividing by 0 in Lox. Rather, it does the same thing as java (and javascript, and IEEE754) in returning Infinity/-Infinity/NaN. Python seems to be the outlier here.

Tested on ruby 2.6 and 3.2.2.