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

Legible output for Instant #3048

Merged
merged 13 commits into from
Jul 7, 2021
Merged

Conversation

eggrobin
Copy link
Member

@eggrobin eggrobin commented Jul 5, 2021

// This subtraction is exact by Sterbenz’s lemma.
Time const remainder = t - start_of_second;
// |remainder| being the result of a subtraction of numbers greater than or
// equal to 1, it is a multiple of 2u ≈ 2⏨-16; 16 fractional decimal digits
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what 2⏨-16 means.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we please use a comprehensible notation and not some prehistoric convention? 2E-16, 2.0E-16, 2×10⁻¹⁶.

Sorry, something went wrong.

// obvious in the case of UTC, which is offset from TT(TAI) by an integer
// number of milliseconds at any time.
EXPECT_THAT((std::stringstream() << "2000-01-01T00:00:00"_UTC).str(),
Eq("2000-01-01T00:01:04,1840000000011059 (TT)"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trailing 11059 is not significant, right? It might change if the implementation changes. I would use a regexp and leave these digits unspecified.

Sorry, something went wrong.

Copy link
Member Author

@eggrobin eggrobin Jul 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation (of operator""_UTC) should be correctly-rounded (it is not, see the TODO below, this was found by looking at those « insignificant » digits, so they test something).
Barring changes of the value being formatted, these digits must not change, except possibly by one unit in the last place: the fractional part (stored in remainder) is computed exactly, and we print 17 digits of it; if we cannot trust the binary-to-decimal code on seventeen digits we cannot ever hope that it will survive round-tripping.

@eggrobin eggrobin mentioned this pull request Jul 6, 2021
@pleroy pleroy added the LGTM label Jul 6, 2021
@eggrobin eggrobin merged commit bc6b5ef into mockingbirdnest:master Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants