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

Consider fate of Decimal #43

Open
parkera opened this issue Apr 18, 2023 · 4 comments
Open

Consider fate of Decimal #43

parkera opened this issue Apr 18, 2023 · 4 comments

Comments

@parkera
Copy link
Member

parkera commented Apr 18, 2023

Decimal is used by a few core types in Essentials, but it probably also needs some updates to be a better citizen in Swift. In ObjC it is a C struct, so it would be difficult to share the sources exactly.

@jasonbobier
Copy link

It also crashes because of missing functionality.

Decimal(exactly: 0)

@xwu
Copy link

xwu commented Apr 28, 2023

Most of the missing functionality was implemented in the open-source version; it was to be synchronized with the Apple version but...well, that hasn't happened. If made part of a new open-source project across all platforms, one can be confident that the missing functionality will not be an issue.

More saliently, though, the Decimal type pre-dates modern IEEE decimal types, and it is likely that we will want those, so it is wise to consider carefully where the legacy type best fits into the picture.

@jasonbobier
Copy link

I remember you mentioning that when I wrote the initial bug. imo, it definitely makes sense to phase out the old legacy Decimal as I don't see any advantages over the IEEE format. One issue that we all encounter with floating points is that at times it is important to know if a number could accurately be represented when doing arithmetic in order to avoid propagating rounding errors.

@jasonbobier
Copy link

Added a discussion in the swift forums here: https://forums.swift.org/t/consider-fate-of-decimal/64708

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

3 participants