Numerics 0.57 released (Hashtables, Bugfix)

1. The main purpose of the release is to implement hash tables (aka associative arrays) with keys of BigCardinal or BigInteger type; such hash tables are important for cryptographic applications. The hash tables in Delphi are implemented by a generic TDictionary<TKey,TValue> class. The release includes a new unit GNumerics.pas with two helper generic classes TBigIntegerDictionary<TValue> and TBigCardinalDictionary<TValue> specializing the base generic dictionary class. For example to work with a hash table having BigInteger keys and string values you need something like this:

uses GNumerics;

  HashTable: TBigIntegerDictionary<string>;
  A: BigInteger;

// create hash table instance
  HashTable:= TBigIntegerDictionary<string>.Create;
  A:= BigInteger('1234567890987654321');
// fill hash table with data
    HashTable.Add(A * A, 'some string value');
// destroy hash table

2. Some bugs fixed; in particular a nasty access violation bug in BigInteger.ModPow function was fixed.

3. Minor changes in BigCardinal/BigInteger methods.

Link to the download page


Version 0.58 fixes the conversion bug from (U)Int64 to BigInteger/BigCardinal.


2 thoughts on “Numerics 0.57 released (Hashtables, Bugfix)

  1. Hello! I like the idea of this Library! But if found a bug in trying this code:

    Procedure TestIt;
    Var b1, b2,
    result : BigInteger;
    i1 : UInt64;
    i1 := 5000000000;
    b1 := i1;
    b2 := 5000000000;
    Writeln (‘b1:’, b1.toString);
    Writeln (‘b1:’, b2.toString);
    result := b1 * b2;
    Writeln (‘Result of b1 * b2: ‘, result.toString);

    It seems as if the assignment of int64- or uint64-values does not work above the 32-Bit limit.
    Result should be 25000000000000000000.
    But the assignments to b1 and b2 delivers a value of 705032704 and therfore the result ist 497071113709551616.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s