Ahh, so Ruby doesn't - and can't[1] - support constant folding.<p>In CPython, because monkey-patching like this isn't supported, the byte compiler turns a "0/2" into a "0.0", as you can see with:<p><pre><code> >>> def f():
... return 0 / 2
...
>>> import dis
>>> dis.dis(f)
2 0 LOAD_CONST 1 (0.0)
2 RETURN_VALUE
</code></pre>
[1] EDIT: except through something like whole-program analysis.
> Long division makes my head hurt!<p>Well, I suspect it has something to do with writing out the process of 5772 / 37 as<p><pre><code> 156
______
37 | 5772
37
---
207
185
----
222
222
---
0
</code></pre>
because it a) reverses the order of dividend and divisor for no good reason; b) the result goes up instead of to the right or down. Why not write it like this<p><pre><code> 5772 | 37
37 +----
--- 156
207
185
----
222
222
---
0
</code></pre>
instead? In fact, I think we could replace the corner with just normal slash, "/", write = to the right of the divisor and spell out the digits of the result to the right of it; the substraction chain will still go down the page.