typocomath/src/Complex/predicate.ts

13 lines
379 B
TypeScript

import { Complex } from './type.js'
export const isReal =
<T>(dep: {
equal: (a: T, b: T) => boolean,
add: (a: T, b: T) => T,
isReal: (z: T) => boolean
}) =>
(z: Complex<T>) => dep.isReal(z.re) && dep.equal(z.re, dep.add(z.re, z.im))
export const isSquare =
<T>(z: Complex<T>) => true // FIXME: not correct for Complex<bigint> once we get there