UNPKG

tough-rational

Version:

Rational class using BigInt with fallback to bignumber.js

8 lines (6 loc) 230 B
'use strict'; Object.assign(module.exports, { absCoerced: (n) => BigInt(n) < BigInt(0) ? -n : n, absNonCoerced: (n) => n < BigInt(0) ? -n : n, absPrototypeMethod: ([ num, den ]) => num < 0 ? [ -num, den ] : [ num, den ] })