import { toFloatOrThrow } from '@terascope/utils' ; export function runMathFn < T extends ( num : number , ... args : number [ ] ) => number > ( fn , ... extra ) { return function _mathFn ( input ) { const num = toFloatOrThrow ( input ) ; const value = fn ( num , ... extra ) ; if ( value === Number . NEGATIVE_INFINITY || value === Number . POSITIVE_INFINITY || Number . isNaN ( value ) ) { return null ; } return value ; } ; }