Opened 3 years ago
Closed 3 years ago
#664 closed defect (fixed)
Lenient BigDecimal division
Reported by: | pcampalani | Owned by: | pcampalani |
---|---|---|---|
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 Changed 3 years ago by pcampalani
- Status changed from new to accepted
comment:2 Changed 3 years ago by dmisev
comment:3 Changed 3 years ago by dmisev
- Resolution set to fixed
- Status changed from accepted to closed
Note: See
TracTickets for help on using
tickets.
Probably fixed