Function Documentation/floor for a square root funciton

Karl Hasselström kha at treskal.com
Mon Mar 14 20:12:27 CET 2005


On 2005-03-14 18:44:39 +0000, DUDE man wrote:

> Anyhow, I need to do a floor of the square root function. I was
> trying to figure out which mpz function to use for it.

You'll want to read the documentation for these two functions again:

void mpz_sqrt (mpz_t rop, mpz_t op)

  Set rop to the truncated integer part of the square root of op.

void mpz_sqrtrem (mpz_t rop1, mpz_t rop2, mpz_t op)

  Set rop1 to the truncated integer part of the square root of op,
  like mpz_sqrt. Set rop2 to the remainder op-rop1*rop1, which will be
  zero if op is a perfect square.

  If rop1 and rop2 are the same variable, the results are undefined.

(Copied from http://www.gnu.org/software/gmp/manual/, since
www.swox.com is not being very cooperative at the moment.)

-- 
Karl Hasselström, kha at treskal.com
      www.treskal.com/kalle


More information about the gmp-discuss mailing list