You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-9Lines changed: 36 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,18 +6,45 @@ bigfloat
6
6
`bigfloat` is a fast arbitrary precision math library optimized for computational geometry and geoinformatics.
7
7
It provides base 2 floating point:
8
8
9
-
-addition
10
-
-subtraction
11
-
-multiplication
12
-
-comparison
13
-
-conversion from JavaScript number type
14
-
- conversion to string in base 2, 10 or 16
9
+
-conversion from JavaScript number type `x = new BigFloat(123.456)`
10
+
-addition `x.add(y)`
11
+
-subtraction `x.sub(y)`
12
+
-multiplication `x.mul(y)`
13
+
-comparison `x.deltaFrom(y)`
14
+
- conversion to string in base 2, 10 or 16`x.toString(10)`
15
15
16
-
without ever losing any significant bits.
16
+
without ever losing any significant bits. Numbers are immutable, so all operations return a new BigFloat.
17
17
18
-
Internally numbers are represented in 32-bit limbs somewhat like in the [GMP](https://gmplib.org/manual/Float-Internals.html) library.
18
+
Internally numbers are represented in 32-bit limbs (digits in base 2^32) somewhat like in the [GMP](https://gmplib.org/manual/Float-Internals.html) library. The least significant limb is stored first, because basic algorithms for arithmetic operations progress from the least to most significant digit while propagating carry. If carry causes the output to grow, adding a new limb at the end of the array is faster than adding it in the beginning.
19
19
20
-
`bigfloat` is optimized for exponents relatively close to zero.
20
+
`bigfloat` is optimized for exponents relatively close to zero, so the location of the decimal point is always present in the limb array, even if that introduces otherwise insignificant leading or trailing zero digits.
0 commit comments