nth_prime

Seth Troisi braintwo at gmail.com
Wed May 22 21:27:27 UTC 2019


I added a small clang-format file[1] and used that to updated my first
patch [2]

[1] https://github.com/sethtroisi/libgmp/blob/master/.clang-format
[2] Add a trivial implementation, docs, and test
https://github.com/sethtroisi/libgmp/pull/7
https://patch-diff.githubusercontent.com/raw/sethtroisi/libgmp/pull/7.patch

All that's left is a small number of conceptional questions
* Does anyone know the reason for "ASSERT (n <= GMP_NUMB_MAX);"
in mpz_primorial_ui.c?
* What should happen on calls for nth_prime(p, 0) return? It feels
undefined but setting p = 2 makes sense as a reasonable default.

---

Looking at what changes when I apply clang-format[1] to other test files
piqued my curiosity
* Would you accept a fix for ~20 instances of missing SpacesBeforeParens[4]
in test files[3]?
* Why do some places use gmp_printf("%Zd") vs mpz_out_str(stdout, 10, <X>)
see [4]
* Is it bad if the signature is "unsigned long int" in gmp-h.in but
"unsigned long" in implementation? see [5]

[3] grep -riI --exclude-dir cxx 'mpz[_a-z0-9]*(' tests/ | grep -v 'printf'
[4]  grep -riI '%Z[dx]' tests/ | wc => 151    vs   grep -riI --color
'mpz_out_str' | wc => 178
[5]
https://github.com/sethtroisi/libgmp/commit/94cb8c96d045af833d8dd629f02afb020517554d


On Tue, May 21, 2019 at 9:50 AM Niels Möller <nisse at lysator.liu.se> wrote:

> Seth Troisi <braintwo at gmail.com> writes:
>
> > I think 1. and 2. are as clean as I know how to make them (I don't see a
> > style guide so apology for formatting / style differences),
>
> To answer the easy question: See
> https://www.gnu.org/prep/standards/standards.html
>
> Regards,
> /Niels
>
> --
> Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
> Internet email is subject to wholesale government surveillance.
>


More information about the gmp-devel mailing list