[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: |
|
||||||||
| 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)). |