Skip to content

Conversation

stephentyrone
Copy link
Contributor

Adapts Date to use a double-Double representation (the underlying representation is the sum of two double-precision values, giving about 106 bits of precision). Keeping a binary floating-point representation means that existing API that converts Date to/from Double values will not see a difference in behavior for simple cases (it will, however, become more accurate in some other cases). Every date computation that was previously exact is still exact. Many cases that previously might have rounded will now generate exact results.

DateInterval gets the same treatment; both its start Date and duration are represented as double-Double quantities with this change.

If we move forward with this change, we'll investigate adding new APIs to make it more convenient to specify high-precision Dates; this change merely makes it possible to do so.

Adapts Date to use a double-Double representation (the underlying representation is the sum of two double-precision values, giving about 106 bits of precision). Keeping a binary floating-point representation means that existing API that converts Date to/from Double values will not see a difference in behavior for simple cases (it will, however, become more accurate in some other cases). Every date computation that was previously exact is still exact. Many cases that previously might have rounded will now generate exact results.

DateInterval gets the same treatment; both its start Date and duration are represented as double-Double quantities with this change.

If we move forward with this change, we'll investigate adding new APIs to make it more convenient to specify high-precision Dates; this change merely makes it possible to do so.
@stephentyrone stephentyrone marked this pull request as draft October 2, 2025 15:47
@stephentyrone
Copy link
Contributor Author

Converted to draft as I want to add some additional comments and tests before this moves forward, but the basic shape of the change is correct, I think.

@parkera
Copy link
Contributor

parkera commented Oct 3, 2025

@swift-ci test

Previously these were disabled because of an API availability issue in 5.8/5.9; we're no longer developing for those targets, so let's re-enable these tests.
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

Successfully merging this pull request may close these issues.

2 participants