michaeldv/awesome_print — pull request #91 by evansenter (2012-06-26 16:16:58+00:00)
Title: Patching awesome_bigdecimal to not have lossy precision.

The formatting of BigDecimal and Rational numbers by calling to_f messes up the precision of the numbers displayed, thus misleading the user as to the value of the number being shown. In example:

1.9.3p194 :001 > require "bigdecimal"
=> true
1.9.3p194 :002 > ap BigDecimal.new("1234567890" * 10)
1.2345678901234567e+99
=> #

This patch addresses that issue by pre-formatting BigDecimal and Rationals with to_s before calling colorize to ensure that all precision is preserved in the output.