Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fasttime/q-exact
A library for exact calculations with rational numbers
https://github.com/fasttime/q-exact
arithmetic exact math q rational
Last synced: about 2 months ago
JSON representation
A library for exact calculations with rational numbers
- Host: GitHub
- URL: https://github.com/fasttime/q-exact
- Owner: fasttime
- License: isc
- Created: 2014-12-22T15:23:00.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-04-24T04:24:06.000Z (over 5 years ago)
- Last Synced: 2024-10-13T14:14:43.691Z (3 months ago)
- Topics: arithmetic, exact, math, q, rational
- Language: JavaScript
- Homepage:
- Size: 154 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
Q-exact
=======A library to make exact calculations with [rational numbers](http://mathworld.wolfram.com/RationalNumber.html) without rounding errors.
Compare this:
`1 / 49 * 49` ▶ `0.9999999999999999`
with this:
`Q(1).over(49).times(49)` ▶ `1`
Q-exact overcomes some of the classic limitations of [floating-point arithmetic](http://mathworld.wolfram.com/Floating-PointArithmetic.html) by requiring that all results be expressed exactly, or not at all.
Rational numbers in Q-exact are stored as products of prime factors.
For example, **-75/28** is represented as **-2-2⋅3⋅52⋅7-1**.
There is no way to represent [irrational numbers](http://mathworld.wolfram.com/IrrationalNumber.html), `Infinity` or `NaN`.See the [**Q Class Reference**](Q-exact.md) for further informations.
*This is a preliminary documentation and may be subject to change at any time.*