Generic Functions
- gmpy2.f2q(x, err=0, /) mpz | mpq
Return the 'best'
mpq
approximating x to within relative error err. Default is the precision of x. Uses Stern-Brocot tree to find the 'best' approximation. Anmpz
object is returned if the denominator is 1. If err<0, relative error is 2.0 ** err.
- gmpy2.cmp_abs(x, y, /) int
Return -1 if abs(x) < abs(y); 0 if abs(x) = abs(y); or 1 else.