Equivalent to bcdiv from php in java -
what equivalent of bcdiv(string, string [, int]) in java
the function divides 2 arbitrary precision numbers
i instance use:
bcdiv(10000,100, 2) results in 100.00
or
bcdiv(10000,100, 3) result in 100.000
i more interested in precision gives.
i equivalent in java
the bigdecimal class allows arbritary precision math. in particular see divide method.
bigdecimal = new bigdecimal(10000);//can take int bigdecimal b = new bigdecimal("100");//or string bigdecimal answer = a.divide(b);
Comments
Post a Comment