Novaleaf / xlib

Your isomorphic toolbox
MIT License
20 stars 1 forks source link

add numHelper.aboutEqual() #6

Closed jasonswearingen closed 5 years ago

jasonswearingen commented 5 years ago
function aboutEqual( input: number, checkAgainst: number, maxDeviationPercent: number, extraSpreadBuffer:number=0 ): boolean {
    return ( (input * ( 1 + maxDeviationPercent ))+extraSpreadBuffer > checkAgainst ) && (( input * ( 1 - maxDeviationPercent ))-extraSpreadBuffer < checkAgainst );
}