I use Ruby 2.2.3 and Rails 4.2.3. I get an NoMemoryError: failed to allocate memory
using the following code in irb console:
# Using 123e+1000000000000000000
BigDecimal('123e+1000000000000000000').to_s
#=> NoMemoryError: failed to allocate memory
But this example with a more bigger number works:
# Using 123e+1000000000000000000000000000000000
BigDecimal('123e+1000000000000000000000000000000000').to_s
#=> "Infinity"
Here the code of BigDecimal
: https://github.com/rails/rails/blob/v4.2.3/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb