User:Mortalmoth
/
Public Domain
Rational field for JavaScript (ℚ). Based on @aureooms/js-rational and @aureooms/js-integer. See docs. Parent is @aureooms/js-algorithms.
⚠️ The code needs a ES2015+ polyfill to run (regeneratorRuntime
), for instance @babel/polyfill.
QQ.from('0.1').add(QQ.from('0.2')).toFixed(); // 0.3
QQ.from(355,113).toFixed(); // 3.|1415929203539823008849557522123893805309734513274336283185840707964601769911504424778761061946902654867256637168