UNPKG

tough-rational

Version:

Rational class using BigInt with fallback to bignumber.js

7 lines (4 loc) 194 B
'use strict'; const pow = require('./pow'); const multiply = require('./multiply'); module.exports = (a, [ num, den ]) => multiply(a, pow([ BigInt(2), BigInt(1) ], [ num / den, BigInt(1) ]));