Exemplo n.º 1
0
Arquivo: int_extra.go Projeto: 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
}
Exemplo n.º 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
}