[FAST-23] DecimalValue(BigDecimal bigDecimal) constructor Created: 06/Jan/09 Updated: 06/Jan/09 |
|
Status: | Open |
Project: | OpenFAST |
Component/s: | Message Object Model |
Affects Version/s: | 1.0.0 |
Fix Version/s: | None |
Type: | Bug | Priority: | Default |
Reporter: | Bartosz Lawniczek | Assignee: | Jacob Northey |
Resolution: | Unresolved | Votes: | 0 |
Labels: | None |
Description |
It seems to me that there should be a minus sign added to the exponent in DecimalValue(BigDecimal bigDecimal) constructor: public DecimalValue(BigDecimal bigDecimal) { this.mantissa = bigDecimal.unscaledValue().longValue(); this.exponent = bigDecimal.scale(); }should be replaced with: public DecimalValue(BigDecimal bigDecimal) { this.mantissa = bigDecimal.unscaledValue().longValue(); this.exponent = -bigDecimal.scale(); }This is because toBigDecimal() function reverses sign of exponent: public BigDecimal toBigDecimal() { return new BigDecimal(BigInteger.valueOf(mantissa), -exponent); } |