Convert Java Number to BigDecimal : best way -
i looking best way convert number bigdecimal.
is enough?
number number; bigdecimal big = new bigdecimal(number.tostring());
can lose precision tostring()
method ?
this fine, remember using constructor of bigdecimal declare value can dangerous when it's not of type string. consider below...
bigdecimal valdouble = new bigdecimal(0.35); system.out.println(valdouble);
this not print 0.35, infact be...
0.34999999999999997779553950749686919152736663818359375
i'd solution safest because of that.