UNPKG

tough-rational

Version:

Rational class using BigInt with fallback to bignumber.js

7 lines (4 loc) 227 B
'use strict'; const dividedToIntegerBy = require('./divided-to-integer-by'); const pow = require('./pow'); module.exports = (a, [ num, den ]) => dividedToIntegerBy(a, pow([ BigInt(2), BigInt(1) ], [ num / den, BigInt(1) ]));