Example #1
0
File: int_extra.go Project: ncw/gmp
// Sqrt sets x to the truncated integer part of the square root of x
//
// NB This is not part of big.Int
func (z *Int) Sqrt(x *Int) *Int {
	x.doinit()
	z.doinit()
	C.mpz_sqrt(&z.i[0], &x.i[0])
	return z
}
Example #2
0
// Sqrt sets z = floor(sqrt(x)) and returns z.
func (z *Int) Sqrt(x *Int) *Int {
	z.doinit()
	x.doinit()
	C.mpz_sqrt(z.ptr, x.ptr)
	return z
}