Opened 10 years ago

Closed 10 years ago

#664 closed defect (fixed)

Lenient BigDecimal division

Reported by: Piero Campalani Owned by: Piero Campalani
Priority: major Milestone: 9.0.x
Component: petascope Version: development
Keywords: bigdecimal rounding division Cc:
Complexity: Trivial

Description

In some parts of the code, division of BigDecimal is done without specifying a rounding mode to avoid exeption on non strictly exact values.
From Java API:

In the case of divide, the exact quotient could have an infinitely long decimal expansion; for example, 1 divided by 3. If the quotient has a nonterminating decimal expansion and the operation is specified to return an exact result, an ArithmeticException is thrown. Otherwise, the exact result of the division is returned, as done for other operations.

All divisions should be made linient through the code, like is done already, e.g. see CrsUtil class.

Change History (3)

comment:1 by Piero Campalani, 10 years ago

Status: newaccepted

comment:3 by Dimitar Misev, 10 years ago

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.