factorial(21) and Mac System Ruby
I just got a new macbook air and discovered this problem with the system ruby. Here’s a simple implementation of factorial.
When you run it in irb it does what you’d expect:
Until the result won’t fit in a Fixnum and needs to fit in a big num. Then it overflows.
My macbook shipped with this version of ruby.
This bug isn’t in ruby, its in the version that Apple is shipping on the newest macbooks. Using rbenv I installed the same patch version and re-ran the factorials.