I'm experimenting with arbitrary precision numbers but I ran into a
precision problem with #power method.

The base:
> b =
BigDecimal("1.034482758620689655172413793103448275862068965517241379310344827586206896551724")

This is nice:
[65] pry(main)> b.power(4.0001,5).to_s("F")
=> "1.1452"

But this one yields gajilion digits, despite the low precision
parameter:
[64] pry(main)> b.power(4.0,5).to_s("F")
=>
"1.145230820564952260841164968378904565512151464552278373093579496692262339862090976570839595577995167
408710258016262277652022322103944542550980444830272550796764510852122423760853182822668783694175299491
998229840756361333048675137604431608257538375836478005205851705333523733848357300705094580513261348742578974976"

Using #round solves the problem, but there is clearly a problem. Any
idea how to properly parameter the method so I don't need to use #round?
Checking the C source (I'm not a C ninja) it looks that a FLOAT value
gets converted if it equals with its rounded self which is certainly
true (although I don't know the precision) if the value is X.0

-- 
Posted via http://www.ruby-forum.com/.