Skip to content
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

Library is broken #5

Open
sublimator opened this issue Dec 15, 2015 · 7 comments
Open

Library is broken #5

sublimator opened this issue Dec 15, 2015 · 7 comments

Comments

@sublimator
Copy link

Assert.AreEqual(16, 
               BigDecimal.Parse("9999,9999,9999,9999".Replace(",", ""))
                           .StripTrailingZeros().Precision);

It fails, with the actual value being 17 ... Yikes! Something to do with StripTrailingZeros ...

I've also seen issues with unnecessary rounding, when Parsing strings with a MathContext with a precision of 16, and where there's only been 16 digits. Probably negative numbers, cause I've seen negative numbers created using a big integer constructor, with a Precision of 17 when there's clearly only 16 digits, and that when you Abs() the value the Precision is 16.

I'm using <package id="dmath" version="1.5.66" targetFramework="net45" />

I feel like this package needs a lot more testing? I don't really have the time at the moment.

@tsutomi
Copy link
Member

tsutomi commented Dec 16, 2015

@sublimator thank you the report: this must be an issue that should be addressed.

As I specified, this library is a port of Harmony's Math package, that I adapted for .NET (for the code and the style), integrating it with some contributions for the big math functions.
I used the same test suite as Harmony, that didn't include the test you've done.

It would be precious if you could help out fixing some things.

Thank you for the support.

@sublimator
Copy link
Author

sublimator commented Dec 16, 2015 via email

@tsutomi
Copy link
Member

tsutomi commented Dec 16, 2015

Thank you for acknowledging the importance: it's actually a missing piece in .NET (even after 4.0 the decimals and astronomical numbers are missing).
I've implemented it to support DeveelDB, so I've never dedicated much time to it, as I should, also because my math knowledge is limited to few courses at the university

I wish to thank you for any support you might give: I will try inspecting any case you will rise up

@sublimator
Copy link
Author

Maybe we can somehow use a Java bridge / J# runtime or something and generate a heap of tests, to match up the implementations ? And expose issues

@tsutomi
Copy link
Member

tsutomi commented Dec 16, 2015

It's a matter of licensing: I used Harmony's version of the Java Math package because it was licensed under MIT, while Java is not so lose on license. This allowed me to use the library also in loose (or commercial) projects.

@sublimator
Copy link
Author

How did you do the code conversion?

@tsutomi
Copy link
Member

tsutomi commented Dec 19, 2015

the old way: manually. :)

once it was ported and tested according to the test suite provided, I changed the design a bit, to make it more .NET fashion (.Parse, .TryParse, properties, etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants