Skip to content

Repository files navigation

BigInt Addition

BigInt Addition provides an example for adding two 64-bit arrays. If LeftLength is greater than RightLength, AddByGreaterLength.asm is executed, if equal, AddByEqualLength.asm is executed. AddByEqualLength requires Length additions. If there is a carry value at the end of the addition, the final value of result is 1. AddByEqualLength requires RightLength additions. If there is a carry value at the end of the addition, 1 is added until the carry value becomes zero. If there is any unprocessed digit left from Left, all of these digits are copied to the result.

Decimal digits count of 64-bit arrays

When performing mathematical operations, we may need operations with higher precision than numbers such as double or float. For example, if we want to find the roots of a quartic function as a double, the input of the function must be greater than the double precision.

LengthByte CountDecimal Count
12810242467
25620484933
51240969865
1024819219719
20481638439447
32768262144631297
655365242881262602

Performance Results

In the performance table below, two random 64-bit numbers of length leftLength and rightLength were multiplied. Each line was run 300 times and the minimum ElapsedTicks values were written with StopWatch(.NET). ExpectedTick(max) belongs to BigInteger(.NET).

leftLengthrightLengthexpectedTick(max)actualTickPercent
64642150%
641282150%
6425622100%
6451233100%
6410247685%
6420481414100%
6432768208214102%
6465536451474105%
1286411100%
1281282150%
12825622100%
1285123266%
12810247685%
1282048141392%
12832768212220103%
1286553647145897%
2566411100%
2561282150%
2562564250%
2565125360%
25610249777%
2562048161487%
2563276821821799%
25665536461464100%
5126422100%
5121283266%
5122565360%
5125128337%
512102412866%
5122048191578%
5123276822021999%
51265536455486106%
10246466100%
102412866100%
10242568787%
102451212758%
1024102419947%
10242048251664%
10243276822421997%
102465536478490102%
204864141392%
2048128141392%
2048256161381%
2048512191473%
20481024251560%
20482048371848%
20483276823622494%
20486553648846495%
3276864217221101%
32768128215220102%
32768256216218100%
3276851222221797%
32768102422921895%
32768204824422793%
327683276860732753%
327686553689763570%
6553664467473101%
65536128463487105%
65536256454492108%
65536512469472100%
65536102447245796%
65536204848544892%
655363276886361871%
6553665536125578162%

About

BigInt Addition

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages