mpz_sqrt_if_perfect_square

Niels Möller nisse at lysator.liu.se
Wed Jun 3 21:35:01 CEST 2026


Seth Troisi <braintwo at gmail.com> writes:

> Everyone loves naming, these are my suggestions. Any of these can have the
> _p predicate suffix attached or not.
> mpz_sqrt_exact_p <- My favorite

To me "exact" (like mpz_divexact) indicates that the function is useful
only of one knows a priori that result *is* exact. And that's not quite
the case for this function, right?

I can imagine an mpz_sqrt_exact function, but it would be a different
thing.

> mpz_sqrt_p
> mpz_sqrt_if_perfect_square
> mpz_perfect_square_with_root
> mpz_perfect_square_root

I think mpz_perfect_square_root is my favorite so far, it matches
mpz_perfect_square_p, and it says that it computes the root.

Regards,
/Niels

-- 
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list