Exemple #1
0
// Denom returns the denominator of x; it is always > 0. The result is a
// reference to x's denominator; it may change if a new value is assigned to
// x, and vice versa.
func (q *Rat) Denom() *Int {
	q.doinit()
	n := new(Int)
	n.init = true
	n.ptr = C._mpq_denref(&q.i[0])
	return n
}
Exemple #2
0
Fichier : rat.go Projet : ncw/gmp
// IsInt returns true if the denominator of z is 1.
func (z *Rat) IsInt() bool {
	z.doinit()
	return C.__mpz_cmp_ui(C._mpq_denref(&z.i[0]), C.ulong(1)) == 0
}