2023-01-22 01:34:57 +00:00
|
|
|
import {Complex} from './type.js'
|
|
|
|
import type {Dependencies, Signature} from '../interfaces/type.js'
|
2023-10-17 22:02:18 +00:00
|
|
|
import {$reflect} from '../interfaces/type.js'
|
2023-01-22 01:34:57 +00:00
|
|
|
|
|
|
|
export const isReal =
|
|
|
|
<T>(dep: Dependencies<'add' | 'equal' | 'isReal', T>):
|
|
|
|
Signature<'isReal', Complex<T>> =>
|
|
|
|
z => dep.isReal(z.re) && dep.equal(z.re, dep.add(z.re, z.im))
|
|
|
|
|
2023-10-17 22:02:18 +00:00
|
|
|
export const isSquare = (): Signature<'isSquare', Complex<unknown>> =>
|
|
|
|
z => true // FIXME: not correct for Complex<bigint> once we get there
|
|
|
|
|
|
|
|
$reflect!([isReal, isSquare])
|