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

Passing -INF through %.16d still puts the minus sign at far-left #81

Open
duffy-ocraven opened this issue Nov 16, 2020 · 1 comment
Open

Comments

@duffy-ocraven
Copy link

Before #77 change gets widely circulated, check whether passing the negative -INF through %.16d still puts the minus sign at far-left

@bbannier
Copy link

A reproducer is

diff --git a/tinyformat_test.cpp b/tinyformat_test.cpp
index 4bb1d60..3e85007 100644
--- a/tinyformat_test.cpp
+++ b/tinyformat_test.cpp
@@ -222,6 +222,7 @@ int unitTests()
     CHECK_EQUAL(tfm::format("%.3d",   std::numeric_limits<double>::quiet_NaN()), "nan");
     CHECK_EQUAL(tfm::format("%.4d",   std::numeric_limits<double>::quiet_NaN()), " nan");
     CHECK_EQUAL(tfm::format("%04.0f", std::numeric_limits<double>::quiet_NaN()), " nan");
+    CHECK_EQUAL(tfm::format("%.5d", -std::numeric_limits<double>::infinity()), " -inf");
 #   endif

     //------------------------------------------------------------

which fails with

test failed, line 225
- inf !=  -inf
[tfm::format("%.5d", -std::numeric_limits<double>::infinity()), " -inf"]

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

2 participants