[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); }
Generated at Sat Nov 23 17:57:13 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.