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

s2f() and s2d() fail with trailing decimal zeros #181

Open
biojppm opened this issue Oct 12, 2020 · 0 comments
Open

s2f() and s2d() fail with trailing decimal zeros #181

biojppm opened this issue Oct 12, 2020 · 0 comments

Comments

@biojppm
Copy link

biojppm commented Oct 12, 2020

It is easy to reproduce this in the unit tests:

// s2f_test.cc
TEST(S2fTest, TrailingDecimalZeros) {
  EXPECT_S2F(1.f, "1");
  EXPECT_S2F(1.f, "1.000");
  EXPECT_S2F(1.f, "1.000000000");  // fail: INPUT_TOO_LONG
  EXPECT_S2F(8388605.f, "8388605");
  EXPECT_S2F(8388605.f, "8388605.00");
  EXPECT_S2F(8388605.f, "8388605.000"); // fail: INPUT_TOO_LONG
}

// s2d_test.cc
TEST(S2dTest, TrailingDecimalZeros) {
  EXPECT_S2D(1.      , "1");
  EXPECT_S2D(1.      , "1.000");
  EXPECT_S2D(1.      , "1.0000000000000000");
  EXPECT_S2D(1.      , "1.00000000000000000"); // fail: INPUT_TOO_LONG
  EXPECT_S2D(8388605., "8388605");
  EXPECT_S2D(8388605., "8388605.000");
  EXPECT_S2D(8388605., "8388605.0000000000");
  EXPECT_S2D(8388605., "8388605.00000000000"); // fail: INPUT_TOO_LONG
}
biojppm added a commit to biojppm/ryu that referenced this issue Oct 12, 2020
This changeset makes some of the earlier failing tests now succeed.
But it triggers an assertion in s2d() and other newer tests fail.
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 a pull request may close this issue.

1 participant