datastax/csharp-driver — pull request #35 by medvekoma (2014-06-19 14:35:25+00:00)
Title: Fix decimal processing

There are a few issues with the current decimal processing:

- .NET decimal numbers that are large enough are not written and read correctly. This is because the .NET decimal stores the absolute value of the bigint part on 12 bytes, while the java BigInteger stores the signed value on a variable number of bytes. Therefore, the bigint part of a .NET decimal can sometimes only fit on 13 bytes.

- DecimalTypeAdapter.ConvertTo does not handle negative values correctly, when the number is a multiple of 256. Adding 1 to bytes[0] causes an overflow in such cases, and that overflow should carried further.

For demonstating both issues, I added a few lines to TypeInterpreterTests, they fail without this fix.

I submitted yesterday another pull request which tried to fix the first issue, but today I rewritten the processing from scratch instead, using the .NET BigInteger class. The other pull request is therefore obsolete.