15 lines
497 B
TypeScript
15 lines
497 B
TypeScript
import { Complex } from './type.js'
|
|
import {FnEqual} from '../interfaces/relational'
|
|
import {FnAdd, FnIsReal, FnIsSquare} from '../interfaces/arithmetic'
|
|
|
|
export const isReal =
|
|
<T>(dep: {
|
|
equal: FnEqual<T>,
|
|
add: FnAdd<T>,
|
|
isReal: FnIsReal<T>
|
|
}): FnIsReal<Complex<T>> =>
|
|
(z) => dep.isReal(z.re) && dep.equal(z.re, dep.add(z.re, z.im))
|
|
|
|
export const isSquare =
|
|
<T>(): FnIsSquare<Complex<T>> => (z) => true // FIXME: not correct for Complex<bigint> once we get there
|