示例#1
0
文件: rat.go 项目: jamesadney/gmp
// 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
}
示例#2
0
文件: rat.go 项目: 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
}