(r: Rational)
| 198 | } |
| 199 | |
| 200 | export 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 | |
| 208 | export function rationalGcd(lhs: Rational, rhs: Rational): Rational { |
| 209 | if (isMachineRational(lhs) && isMachineRational(rhs)) { |
no test coverage detected