-
Notifications
You must be signed in to change notification settings - Fork 194
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
Print big integers with (f)printf #551
base: develop
Are you sure you want to change the base?
Conversation
Failure of The other one "/home/runner/work/libtommath/libtommath/demo/test.c:382: undefined reference to `mp_printf_extension'" needs a bit more work, I'm afraid. |
I broke it? |
Rebased to hide all of the pain ;-) |
The problem with the unchecked input for |
These are prefix modifiers like
Prefixes of the printed numbers are:
Most letters of the English alphabet, both upper and lower case, are already taken by printf(3)'s format. The modifiers can be more than one character, so something like "b16N" or "b64N" would come handy but the letter "b" might get taken by C2x for binary representation. Digits without anything else are possible, too. BTW: the way it works is that for every modifier one bit of a The modifier accepting function takes Not implemented are:
This function is not thread safe! But who would expect thread safety from a The functions to print a single limb and the raw limb-array ( |
No, that is way to much effort to print a simple native integer, there must be a simpler way to do it. Or at least without the heavy artillery ( |
Conflict is an empty line in |
9b730c5
to
cbac591
Compare
@sjaeckel I saw that I forgot to add Phew, took by far more time to write the tests for all our optional flavours than to write the actual code! ;-) But that is what the GLibC printf-extension is able to do: print the big integer, one limb and the limb-array in all useful bases and the formatting that printf offers (sans the thousand-separators, don't think it is a good idea to start meddling with locales, but maybe an underbar for all locales, a space (U+2009?) maybe?). The documentation is a bit sparse for now. I'll check later. The extension allows for some more fiddling. It is, for example, possible to set the padding character (a
|
Simple implementation of a big integer extension to
printf(3)