The markdown parsing is broken/disabled for release notes. Sorry about that, I'm chasing the source of a crash that's been bringing this website down for the last couple of days.
New in release 1.14.0:
1) Continued fractions are supported: A BFraction instance can be created from a continued fraction
represented as a sequence of integers.
A continued fraction (a sequence of integers) can be created from a BFraction instance.
2) A new BFraction static function computes harmonic numbers, like 1 + 1/2 + ... + 1/n.
3) General improved performance in BFraction arithmetic.
Release 1.13.1
19 weeks ago
Release 1.13.1 is a bugfix release.
Bill James (wjamesjr) reported a bug in the Burnikel-Ziegler division function.
It gave wrong results for certain inputs.
He also provided test data that helped fix the bug, thanks.
The bug is fixed in release 1.13.1
New in release 1.13.0:
1) A new BFraction constructor from a string representation
public init?(_ x: String)
for example
BFraction("3.1415") // = 6283 / 200
BFraction("123E-3") // = 123 / 1000
BFraction("abc") // = nil
2) A new BFraction 'mod' method to compute the value modulo an integer
public func mod(_ m: BInt) -> BInt?
public func mod(_ m: Int) -> Int?
for example
BFraction(13, 3).mod(5) // = Optional(1) because 3^(-1) mod 5 = 2 and (13 * 2).mod(5) = 1
Returns nil if the denominator and modulus are not coprime
3) The BFraction method 'asDecimalString' has a new API
public func asDecimalString(precision: Int, exponential: Bool = false) -> String
where precision is the number of significant digits
and exponential determines whether to use exponential or plain notation. For example
BFraction(712, 11001).asDecimalString(precision: 5, exponential: false) // = "0.064721"
BFraction(712, 11001).asDecimalString(precision: 5, exponential: true ) // = "6.4721E-2"
4) A new static BFraction method 'bernoulliSequence'
public static func bernoulliSequence(_ n: Int) -> [BFraction]
BFraction.bernoulliSequence(n) computes the n even indexed Bernoulli numbers B(0), B(2) ... B(2 * n - 2)
This is much faster than computing the same numbers individually.
About BigInt release 1.12.0:
1) There is a new CRT structure which implemnts The Chinese Remainder Theorem.
It contains constructors to create an instance from given moduli
and a 'compute' method to compute the CRT value for a given set of residues.
The same instance can be used again for other input data.
2) The newly introduced 'bernoulli' method to compute Bernoulli numbers had poor performance.
Its implementation is now changed to something more performant.
For example 'bernoulli(1000)' now runs more than 250 times faster than it did before.
About BigInt release 1.11.0:
1) The functionality and API is the same as in release 1.10.0
2) Apple has removed the function
swift package generate-xcodeproj
in Xcode 14.3. This means that it is no longer possible to generate a Swift Package
and then turn it into an Xcode project, in order to define testability.
Since there is now no Xcode project where testability can be enabled, the line
@testable import BigInt
must be inserted in every test file, in order to still be able to run the testsuite.
This has been done in release 1.11.0
The testsuite must be run in release mode, otherwise it takes forever.
This can be done from the command line with
swift test -c release -Xswiftc -enable-testing
The above considerations are only relevant for the development of BigInt,
not for people who just use BigInt.
New in release 1.10.0:
1) General performance improvements. In particular the 'modInverse' function has become faster.
If the modulus is a power of 2, it typically runs 10 times faster than it did before.
2) The BFraction structure has a new static method 'bernoulli', which computes Bernoulli numbers. For example
print(BFraction.bernoulli(60))
print(BFraction.bernoulli(60).asDouble())
would print
-1215233140483755572040304994079820246041491 / 56786730
-2.1399949257225335e+34
The largest Bernoulli number that can be represented as a Double is bernoulli(258)
Release 1.9.0
34 weeks ago
New in release 1.9.0:
The addition, subtraction, multiplication and shift operations have been modified
to use the 'withUnsafeMutableBufferPointer' function in order to avoid
that the compiler generates - in this case unneccesary - array index bound checks.
This speeds up the execution. For example, the BigInt testsuite runs about 8 - 10% faster than it did before.
Thanks to Jack Leow for suggesting the use of 'withUnsafeMutableBufferPointer'.
Performance improvements in release 1.8.0:
1) The 'gcdExtended' function is now implemented using using Lehmer's method.
For 1000-bit numbers, it means that it now runs 5-6 times faster than before.
2) The 'modInverse' function now computes its result using the 'gcdExtended' function.
For 1000-bit numbers, it means that it now runs 3-4 times faster than before.
Release 1.7.0
38 weeks ago
New in release 1.7.0:
1) In addition to the method
public func expMod(_ x: BInt, _ m: BInt) -> BInt
there is a new method
public func expMod(_ x: BInt, _ m: Int) -> Int
where the modulus is an 'Int' instead of a 'BInt'
a.expMod(x, 17) is much faster than a.expMod(x, BInt(17))
2) In addition to the method
public func sqrtMod(_ p: BInt) -> BInt?
there is a new method
public func sqrtMod(_ p: Int) -> Int?
where the prime number is an 'Int' instead of a 'BInt'
a.sqrtMod(17) is much faster than a.sqrtMod(BInt(17))
New in release 1.6.0:
1) A new constructor to create a BInt from a decimal value i.e BInt(1.7e12)
2) A 'quotientExact' method where a.quotientExact(b) is faster than a / b if it is known that the remainder of the division is 0
3) A 'population' computed property that gives the number of 1 bits in a BInt, i.e. BInt(14).population is 3