UNPKG

tough-rational

Version:

Rational class using BigInt with fallback to bignumber.js

10 lines (7 loc) 230 B
'use strict'; const powGenerator = require('./pow-generator'); const pow = powGenerator(); module.exports = ([ aNum, aDen ], [ bNum, bDen ]) => { const bInt = bNum / bDen; return [ aNum * (pow(BigInt(10), bInt)), aDen ]; };