Skip to content

If %e specifiers are enabled without enabling %f specifiers, then neither are provided. #38

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

Closed
mickjc750 opened this issue Aug 29, 2021 · 6 comments
Assignees
Labels
bug Something isn't working resolved-on-develop A changeset fixing this issue has been commiutted to the development branch

Comments

@mickjc750
Copy link

Enabling option PRINTF_SUPPORT_EXPONENTIAL_SPECIFIERS but not PRINTF_SUPPORT_FLOAT_SPECIFIERS.
Yields neither..
This may occur if an application really only wants the exponent format.

@eyalroz eyalroz added the bug Something isn't working label Sep 5, 2021
eyalroz added a commit that referenced this issue Sep 6, 2021
@eyalroz
Copy link
Owner

eyalroz commented Sep 6, 2021

I don't actually see this happening...

/home/eyalroz/src/mine/mpaland-printf/test/test_suite.cpp:849: PASSED:
  CHECK( !strcmp(buffer, "4.895512e+04") )
with expansion:
  true
with messages:
  test::sprintf_ arguments, replicated ( "arg := arg" ):
  ----
  "%e" := "%e"
  48955.125 := 48955.125
  ----
  Resulting buffer contents: "4.895512e+04"

etc.

@eyalroz
Copy link
Owner

eyalroz commented Sep 18, 2021

@mickjc750 : ping.

@mickjc750
Copy link
Author

@eyalroz
I'm not sure how to reproduce your snippet from the test_suit. I originally saw this issue when compiling the .c and .h files alongside the AVR test. But I can reproduce it on a desktop with the following steps :

Edit the printf_config.h.in to the following:
#cmakedefine PRINTF_SUPPORT_DECIMAL_SPECIFIERS 0
#cmakedefine PRINTF_SUPPORT_EXPONENTIAL_SPECIFIERS 1
#cmakedefine PRINTF_SUPPORT_LONG_LONG 1
#cmakedefine PRINTF_ALIAS_STANDARD_FUNCTION_NAMES 1

Edit the autotest.cpp to include the following on line 118 after the usage message:
sprintf_(txt, "%%e = %e %%f = %f", 8E41, 0.97341);
printf("%s\n",txt);

Then:
cmake .
make
sudo make install
cd test
cmake .
cp ../include/printf_config.h .
make
./autotest

The output after the usage message shows:
%e = e %f = f

@eyalroz
Copy link
Owner

eyalroz commented Sep 19, 2021

Well, it seems I have a bug with the CMake generation of printf_config.h. When I fix that (see #41), I see what you're seeing.

eyalroz added a commit that referenced this issue Sep 19, 2021
…al specifiers are disabled. Also, corrected some test suite code which caused failures when only decimal or only exponential specifiers are enabled.
@eyalroz
Copy link
Owner

eyalroz commented Sep 19, 2021

@mickjc750 : Please try this out.

@mickjc750
Copy link
Author

@eyalroz confirmed fixed.

@eyalroz eyalroz self-assigned this Sep 20, 2021
@eyalroz eyalroz added the resolved-on-develop A changeset fixing this issue has been commiutted to the development branch label Sep 20, 2021
eyalroz added a commit that referenced this issue Sep 27, 2021
eyalroz added a commit that referenced this issue Sep 27, 2021
…al specifiers are disabled. Also, corrected some test suite code which caused failures when only decimal or only exponential specifiers are enabled.
@eyalroz eyalroz closed this as completed Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved-on-develop A changeset fixing this issue has been commiutted to the development branch
Projects
None yet
Development

No branches or pull requests

2 participants