[FAST-36] BigDecimals are not correctly interpreted in DecimalValue constructor Created: 23/May/11  Updated: 20/Oct/11  Resolved: 20/Oct/11

Status: Resolved
Project: OpenFAST
Component/s: Types
Affects Version/s: 1.0.1
Fix Version/s: 1.0.3

Type: Bug Priority: Major
Reporter: Paul Gribben Assignee: Jacob Northey
Resolution: Fixed Votes: 0
Labels: encoding
Environment:

JRE 1.6, Windows and Linux


Issue Links:
Duplicate
is duplicated by FAST-37 BigDecimal constructor for DecimalVal... Resolved

 Description   

BigDecimal scale is mis-interpreted as being identical to exponent, resulting in incorrect number conversion. According to java doc for BigDecimal the value is: unscaledValue × 10^(-scale), whereas for openfast DecimalValue the value is: mantissa x 10^(exponent). Therefore exponent = -bigDecimal.scale (and not bigDecimal.scale).

To test this, encode BigDecimal(2.4) then decode the byte stream and you'll get 240 (24 x 10^1, but should be 24 x 10^(-1)).


Generated at Sat Nov 23 12:43:29 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.