Cleanup mpz_out_str in tests

Seth Troisi braintwo at gmail.com
Thu Mar 26 09:10:33 UTC 2020


My first patch mistakenly used %xZx instead of %#Zx, if want to move
forward prefer the patch in this mail.

On Thu, Mar 26, 2020 at 1:24 AM Marco Bodrato <bodrato at mail.dm.unipi.it>
wrote:

> Ciao,
>
> Il 2020-03-26 02:15 Seth Troisi ha scritto:
> > This cleans up a number of
> >
> > printf(...)
> > mpz_out_str(stdout, 10/16, var);
> > printf(...);
> >
> > and replaces them with
> >
> > gmp_printf(...%Zd..., var);
>
> Why? Is the current code not working?
>

The tests are weirdly fragmented in how they print mpz, and I was trying to
make them more uniform.
"Why" today was that I had a little time today and long ago Neils had given
this idea a soft yes.


> In mini-gmp we have mpz_out_str, but we don't have gmp_printf.
> The code with mpz_out_str is (more) easily re-usable with mini-.
>

Is it a problem if it's only test code that's being changed?

I already see a reasonable amount of use of gmp_printf (54 uses) and
gmp_fprintf (51 uses) in the 23 tests + 4 test utility.
If you feel strongly that this is bad, maybe we should go and rip out the
existing uses of gmp_[f]printf?


>
> Ĝis,
> m
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tests_mpz_out_str2.patch
Type: text/x-patch
Size: 10958 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-devel/attachments/20200326/ffa5d6a2/attachment.bin>


More information about the gmp-devel mailing list