MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / get_quotient

Function get_quotient

ar.py:50–61  ·  view source on GitHub ↗
(v: float)

Source from the content-addressed store, hash-verified

48
49
50def get_quotient(v: float) -> tuple[int, int]:
51 n = v
52 d = 1
53 while abs(n - round(n)) > TOL:
54 d += 1
55 n += v
56 if d > MAX_DENOMINATOR:
57 e = InfQuotientError(v)
58 raise e
59
60 n = int(round(n))
61 return simplify(n, d)
62
63
64def fix_v(v: float) -> float:

Callers 2

fix_vFunction · 0.85
frac_stringFunction · 0.85

Calls 2

InfQuotientErrorClass · 0.85
simplifyFunction · 0.70

Tested by

no test coverage detected