Comparing two doubles
Hi,
I'm working on a root finder function (something like Bissection or Newton) and I'm facing one doubt
Use doubles to perform the algorithm or use BigDecimal?
doubles give me faster computing but at some point I must compare the results with zero.For example I'm getting
-1.0
0.25
-0.4375
-0.109375
0.06640625
-0.0224609375
0.021728515625
-4.2724609375E-4
0.0106353759765625
0.005100250244140625
0.0023355484008789062
9.539127349853516E-4
...
(one line for each iteration)
and for each iteration I want to compare the result with 0 (zero). I want also a precision of, say, 8 decimal digits. How can I accomplish that?
Should I convert the doubles to BigDecimal and set a scale and then compare?
thanks in advance

