MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / sqrt

Function sqrt

src/compute-engine/numerics/rationals.ts:200–206  ·  view source on GitHub ↗
(r: Rational)

Source from the content-addressed store, hash-verified

198}
199
200export function sqrt(r: Rational): Rational | undefined {
201 const num = Math.sqrt(Number(r[0]));
202 const den = Math.sqrt(Number(r[1]));
203 if (Number.isInteger(num) && Number.isInteger(den)) return [num, den];
204
205 return undefined;
206}
207
208export function rationalGcd(lhs: Rational, rhs: Rational): Rational {
209 if (isMachineRational(lhs) && isMachineRational(rhs)) {

Callers 3

gen_cases.pyFile · 0.50
gen.pyFile · 0.50
gen_solve.pyFile · 0.50

Calls 2

sqrtMethod · 0.65
isIntegerMethod · 0.45

Tested by

no test coverage detected