const { abs , min , max } = Math ; /**
 *  https public export namespace Real { export function isReal ( value ) ; export function isReal ( value ) ; export function isReal ( value ) { return typeof value === "number" && Number . isFinite ( value ) ; } export function add ( p , q ) { return p + q ; } export function subtract ( p , q ) { return p - q ; } export function multiply ( p , q ) { return p * q ; } export function divide ( p , d ) { return p / d ; } /**
     * Compute the modulus of a division of two reals.
     *
     *  https remarks export function modulo ( p , d ) { return ( ( p % d ) + d ) % d ; } /**
     * Clamp a real between a lower and an upper value.
     */ export function clamp ( p , l , u ) { return max ( l , min ( p , u ) ) ; } /**
     * Round a real to a given number of decimals.
     */ export function round ( p , n = 0 ) { return n === 0 ? Math . round ( p ) : Math . round ( p * 10 ** n ) / 10 ** n ; } /**
     * Check if two reals are equal, accounting for floating-point precision
     * errors according to a given epsilon.
     */ export function equals ( a , b , e = Number . EPSILON ) { if ( a === b ) { return true ; } const diff = abs ( a - b ) ; if ( a === 0 || b === 0 ) { return diff < e ; } return diff / min ( abs ( b ) + abs ( a ) , Number . MAX_VALUE ) < e ; } }