matthew016
asked on
BigDecimal
Hi,
I want to divide a BigDecimal by 100,
total = total.divide(new BigDecimal("100"), ?? );
Can you please help me what the other params must be to have a usual behaviour ?
Thank you.
I want to divide a BigDecimal by 100,
total = total.divide(new BigDecimal("100"), ?? );
Can you please help me what the other params must be to have a usual behaviour ?
Thank you.
u can supply other parsms to specify scale/rounding if the default behavior does not meet your need.
> total = total.divide(new BigDecimal("100"));
that will leave the scale thew same (as total)
that will leave the scale thew same (as total)
ASKER
It seems to me that arguments are necessary.
Otherwise I get a compiling error.
I use jdk 1.4.x
Otherwise I get a compiling error.
I use jdk 1.4.x
then you'll need the following:
total = total.divide(new BigDecimal("100"), BigDecimal.ROUND_HALF_DOWN );
change the round mode to meet your needs.
total = total.divide(new BigDecimal("100"), BigDecimal.ROUND_HALF_DOWN
change the round mode to meet your needs.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
total = total.divide(new BigDecimal("100"));