UNPKG

tough-rational

Version:

Rational class using BigInt with fallback to bignumber.js

6 lines (3 loc) 196 B
'use strict'; const fractionalComponent = require('./fractional-component'); module.exports = (n) => fractionalComponent(n).gte(0.5) ? n.dividedToIntegerBy(1).plus(1) : n.dividedToIntegerBy(1);