BigInteger redux

TForge 0.72 is released.

What’s new:

  • Big integer arithmetic is included in TForge package; that is BigCardinal and BigInteger classes are now available after installing TForge package, without dll. Old dll implementation (Numerics 0.58) is still available but is not developed for now.
  • More demo projects added.
  • Improved FPC/Lazarus support; TCiphers package and demos are ported to FPC/Lazarus.
  • Several new methods are added to ByteArray class.
Advertisements

11 thoughts on “BigInteger redux

  1. Great stuff, just a small suggestion though for easier compilation. Can you make search paths in the projects relative rather than assuming the library is installed at C:\TForge 🙂

    • Could you be more specific? I tried to use relative paths where it is possible; sometimes Delphi (XE) does not allow relative paths, ex. I was not able to set a relative path to the “Include” folder.

      • Thanks Serg. It was the include directory:)
        I find that “../” in the path works to go up one level so you can then include a sibling or related directory.

  2. Hi Serg,
    I’ve try to compile tforge072 it with XE7 and I’ve got the following error:

    [dcc32 Fehler] tfNumbers.pas(2596): E2099 Ăśberlauf bei Konvertierung oder arithmetischer Operation
    MaxValue = TLimb(TLimbInfo.MaxLimb shr 1 + 1);

    [dcc32 Fehler] tfNumbers.pas(4468): E2015 Operator ist auf diesen Operandentyp nicht anwendbar
    Result:= (PWord(P) + Index)^;

    • the first: try

      MaxValue = TLimb(TLimb(TLimbInfo.MaxLimb shr 1) + TLimb(1));
      

      the second looks like my mistake; add

      {$IFDEF TFL_POINTERMATH}
        {$POINTERMATH ON}
      {$ENDIF}
      

      right after {$I TFL.inc}

      Does the above solve the problems?

  3. Hi Serg,
    now it compiles fine under XE7, but only in debug!
    In release the following error occurs:
    [dcc32 Fehler] tfNumbers.pas(4288): E1012 Konstantenausdruck verletzt untere Grenzen
    [dcc32 Fehler] tfNumbers.pas(4343): E1012 Konstantenausdruck verletzt untere Grenzen
    if Tmp.FLimbs[1] 0 then Tmp.FUsed:= 2;

    • Thank you!

      Replace (line 35 before patching, should be line 38-40 after patching)

      {$ELSE}
          TLimbArray = array[0..0] of TLimb;
      {$ENDIF}
      

      by

      {$ELSE}
          TLimbArray = array[0..1] of TLimb;
      {$ENDIF}
      
  4. Now I’ve got the following Messages:

    [dcc32 Fehler] tfNumbers.pas(441): E2072 Anzahl der Elemente (1) weicht von der Deklaration (2) ab
    FLimbs: (0);
    [dcc32 Fehler] tfNumbers.pas(454): E2072 Anzahl der Elemente (1) weicht von der Deklaration (2) ab
    FLimbs: (1);
    [dcc32 Fehler] tfNumbers.pas(467): E2072 Anzahl der Elemente (1) weicht von der Deklaration (2) ab
    FLimbs: (1);
    [dcc32 Warnung] tfNumbers.pas(4672): W1023 Vorzeichenbehaftete und -lose Typen werden verglichen – beide Operanden werden erweitert
    until I >= L;

    • Yes. You need to add one more zero to the 3 arrays now, ex replace

          FLimbs: (1);
      

      by

          FLimbs: (1, 0);
      

      As for the warning, it affects only performance, I will fix it in the next release.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s