Sorry if this is obvious, but I search Google, Stack Overflow, and the Ruby documentation and I couldn’t find it.
How would I go about making a higher precision decimal? For example, in IRB,
irb(main):001:0> 3.14159265358979323846
=> 3.141592653589793
It cuts off some of the decimal. How do I keep the whole decimal?
You need to use the
BigDecimalclass: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/bigdecimal/rdoc/BigDecimal.htmlExample: