math5/src/interfaces/arithmetic.ts

20 lines
607 B
TypeScript

import type {ClosureType, NaNType, RealType} from './type'
type UnOp<T> = (a: T) => T
type BinOp<T> = (a: T, B: T) => T
declare module "./type" {
interface CommonInterface<T, Aux> {
add: BinOp<T>
unaryMinus: UnOp<T>
conj: UnOp<T>
subtract: BinOp<T>
multiply: BinOp<T>
square: UnOp<T>
absquare: (a: T) => RealType<T>
reciprocal: UnOp<T>
divide: BinOp<T>
conservativeSqrt: (a: T) => (T | NaNType<T>)
sqrt: (a: T) => (T | ClosureType<T>)
}
}