22 lines
617 B
TypeScript
22 lines
617 B
TypeScript
import {ImpType} from '../core/Dispatcher.js'
|
|
import type {UnderlyingReal} from '../Complex/type.js'
|
|
|
|
export const number_type = {
|
|
before: ['Complex'],
|
|
test: (n: unknown): n is number => typeof n === 'number',
|
|
from: {string: s => +s}
|
|
}
|
|
|
|
|
|
export interface NumbersImpTypes {
|
|
zero: (a: number) => 0
|
|
one: (a: number) => 1
|
|
nan: (a: number) => typeof NaN
|
|
re: (a: number) => number
|
|
}
|
|
|
|
export const zero: ImpType<'zero', [number]> = a => 0
|
|
export const one: ImpType<'one', [number]> = a => 1
|
|
export const nan: ImpType<'nan', [number]> = a => NaN
|
|
export const re: ImpType<'re', [number]> = a => a
|