// SetFloat64 sets z to exactly f and returns z. // If f is not finite, SetFloat returns nil. func (z *Rat) SetFloat64(f float64) *Rat { if math.IsNaN(f) || math.IsInf(f, 0) { return nil } z.doinit() C.mpq_set_d(&z.i[0], C.double(f)) return z }
// SetDouble sets f = x and returns q. func (q *Rat) SetDouble(x float64) *Rat { q.doinit() C.mpq_set_d(&q.i[0], C.double(x)) return q }