-
-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect BigDecimal
fraction representation (2.9 -> 2.10 change)
#139
Comments
Ok. Sounds like there is a problem, and looks like information included should be enough to reproduce the problem as a unit test. |
Hmmh. Ok, yes. Looks like I interpreted exponent the wrong way, but for better or worse it is consistently so, meaning that Jackson can read content it writes. The challenge here is backwards compatibility. I think that I will fix this for 2.10, instead of 2.9 patch, since this does change working quite drastically. |
Looks good, thanks for fixing. |
… by CBOR generator < v2.10 with bug FasterXML#139. Assumes all generated BigDecimal values had negative exponents to begin with so not generally applicable to community at large.
…FasterXML/jackson-dataformats-binary#139. This way the recipient can see if the message was encoded with >= 2.10 CBOR version, or else < 2.10 with the bug present.
…nt negation, so bug FasterXML#139 fix can be toggled on/off to support backwards compatibility.
@cowtowncoder, It's a great shame, guys, great shame :-( |
@cynogit Mark what as breaking change? A fix? What kind of sense would that make? It is unfortunate that the bug existed of course. I will add a note on 2.10 release wiki page, but this is the first time I have heard a complaint from users. Also: if you wanted to actually help instead of bitch and whine about a free product, you are free to help with release candidate process: this is where most compatibility problems are found, by people who are collaborating on improving things. Instead of simply enjoying free labor of others. |
BigDecimal
fraction representation (2.9 -> 2.10 change)
@cowtowncoder, consider you already have a production DB written with 2.9. Reading it with 2.10 will produce objects with incorrect values. That is why it is a breaking change. |
According to the spec, decimal fractions (tag 4) of value m * 10^e should be represented as a tagged array containing the exponent e and the mantissa m. However, Jackson writes BigDecimals as tagged arrays containing their scale and unscaled value. The difference being that the value of BigDecimal is unscaled value * 10^-scale, which means the scale is the opposite of the exponent e.
The spec gives an example how 273.15 should be represented:
Here is the actual representation:
The text was updated successfully, but these errors were encountered: