-
Notifications
You must be signed in to change notification settings - Fork 146
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
Decimal floating-point #7
Comments
We would like to second the request for this feature. For financial applications where values will not exceed the limits of UInt128 and where precision in values is key, having a Decimal128 implementation (or Decimal64) would be very helpful. |
I agree with @paulrs that Decimal128 would be extremely valuable for financial applications. |
Especially since Foundation's Decimal causes a fatal error in this simple case: let d = Decimal(exactly: 0) and Apple seems unwilling to fix it (I reported it January 17, 2021). |
@jasonbobier The fatal error was simply that the API was unimplemented; it's been implemented in the open-source swift-corelibs-foundation for some years now and Apple's proprietary implementation will pick up the changes on some timeline of their choosing. |
@xwu sigh "Some timeline of their choosing" is accurate. I have bugs from 2003 still open with them. |
Is there any update on this? |
I have an implementation of this including Decimal32, Decimal64, and Decimal128. Decimal32 is mostly tested but the other implementations require testing. This is a pure Swift implementation based on the Intel Corp Decimal Floating-Point Math Library v2.2. BTW, this is a IEEE 754 implementation. How would I upload this code so others can contribute? See https://github.com/mgriebling/MGDecimal for details. |
Implement IEEE 754 Decimal128 (and possibly Decimal64 as well, though it's less important). This has a dependency on fixed-width integer types because we want to be able to leverage UInt128 arithmetic for the implementation.
The text was updated successfully, but these errors were encountered: