Recent

Author Topic: Laz/FPC version of Velthuis arbitrary precision package for Dephi  (Read 2699 times)

MathMan

  • Sr. Member
  • ****
  • Posts: 325
Hello all,

Is there, by any chance, somebody around here who has converted Rudy Velhuis arbitrary precision package for Delphi to a compilable & working Laz/FPC variant?

Src: https://github.com/rvelthuis/DelphiBigNumbers
Web: http://rvelthuis.de/programs/bigintegers.html

I would like to do some comparisons with my own package (in the making) and tried to convert it, with the help of the available converter tools from Laz/FPC. However I must admit I am not versed enough in Delphi & Laz/FPC to get it going.

Any feedback highly appreciated - even if it is just hints, what I need to look at to get it going myself.

My current environment is Laz 1.8.2 / FPC 3.0.4 on x86-64 Linux.

Kind regards,
MathMan

Thaddy

  • Hero Member
  • *****
  • Posts: 14358
  • Sensorship about opinions does not belong here.
Re: Laz/FPC version of Velthuis arbitrary precision package for Dephi
« Reply #1 on: March 30, 2019, 10:43:16 am »
I was almost finished making it compatible, but I ran into an internal error 200706094, so I can't finish it before that is resolved.
In principle it was not much work. I reported the bug.
Code: Pascal  [Select][+][-]
  1. {$MODE DELPHI}
  2. {$RANGECHECKS OFF}
  3. {$OVERFLOWCHECKS OFF}
  4.  
  5. function SplitMix64(var X: UInt64) : UInt64;
  6. var
  7.   Z: UInt64;
  8. begin
  9.   Inc(X, UInt64($9E3779B97F4A7C15)); // internal error
  10.   Z := (X xor (X shr 30)) * UInt64($BF58476D1CE4E5B9);
  11.   Z := (Z xor (Z shr 27)) * UInt64($94D049BB133111EB);
  12.   Result := Z xor (Z shr 31);
  13. end;
  14.  
  15. begin
  16. end.

Much of the code already works, but I want the complete library to compile.


« Last Edit: March 30, 2019, 10:45:17 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Xor-el

  • Sr. Member
  • ****
  • Posts: 404
Re: Laz/FPC version of Velthuis arbitrary precision package for Dephi
« Reply #2 on: March 30, 2019, 11:46:53 am »
I was almost finished making it compatible, but I ran into an internal error 200706094, so I can't finish it before that is resolved.
In principle it was not much work. I reported the bug.
Code: Pascal  [Select][+][-]
  1. {$MODE DELPHI}
  2. {$RANGECHECKS OFF}
  3. {$OVERFLOWCHECKS OFF}
  4.  
  5. function SplitMix64(var X: UInt64) : UInt64;
  6. var
  7.   Z: UInt64;
  8. begin
  9.   Inc(X, UInt64($9E3779B97F4A7C15)); // internal error
  10.   Z := (X xor (X shr 30)) * UInt64($BF58476D1CE4E5B9);
  11.   Z := (Z xor (Z shr 27)) * UInt64($94D049BB133111EB);
  12.   Result := Z xor (Z shr 31);
  13. end;
  14.  
  15. begin
  16. end.

Much of the code already works, but I want the complete library to compile.

@Thaddy, I have encountered this problem quite a number of times and below is how I circumvented it. (by assigning that constant to a variable);

Code: Pascal  [Select][+][-]
  1. function SplitMix64(var X: UInt64): UInt64;
  2. var
  3.   Z, K: UInt64;
  4. begin
  5.   K := UInt64($9E3779B97F4A7C15); // assign the constant to a variable first
  6.   Inc(X, K);
  7.   Z := (X xor (X shr 30)) * UInt64($BF58476D1CE4E5B9);
  8.   Z := (Z xor (Z shr 27)) * UInt64($94D049BB133111EB);
  9.   Result := Z xor (Z shr 31);
  10. end;
  11.  
« Last Edit: March 30, 2019, 11:51:10 am by Xor-el »

Thaddy

  • Hero Member
  • *****
  • Posts: 14358
  • Sensorship about opinions does not belong here.
Re: Laz/FPC version of Velthuis arbitrary precision package for Dephi
« Reply #3 on: March 30, 2019, 11:59:28 am »
I know the work-around, but the internal error should be fixed. It is legal code.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

MathMan

  • Sr. Member
  • ****
  • Posts: 325
Re: Laz/FPC version of Velthuis arbitrary precision package for Dephi
« Reply #4 on: March 31, 2019, 11:06:41 am »
I was almost finished making it compatible, but I ran into an internal error 200706094, so I can't finish it before that is resolved.
In principle it was not much work. I reported the bug.

Much of the code already works, but I want the complete library to compile.

Thanks Thaddy - that sounds very promising!

My objective is to do some benchmark comparison. If your current state of the library could support this objective I'd be glad to give it a try and report back my findings. In addition I'm also benchmarking against Wolfgang Ehrhardts arbitrary precision library.

Kind regards,
Jens

MathMan

  • Sr. Member
  • ****
  • Posts: 325
Re: Laz/FPC version of Velthuis arbitrary precision package for Dephi
« Reply #5 on: April 30, 2019, 07:59:27 am »
I was almost finished making it compatible, but I ran into an internal error 200706094, so I can't finish it before that is resolved.
In principle it was not much work. I reported the bug.
Code: Pascal  [Select][+][-]
  1. {$MODE DELPHI}
  2. {$RANGECHECKS OFF}
  3. {$OVERFLOWCHECKS OFF}
  4.  
  5. function SplitMix64(var X: UInt64) : UInt64;
  6. var
  7.   Z: UInt64;
  8. begin
  9.   Inc(X, UInt64($9E3779B97F4A7C15)); // internal error
  10.   Z := (X xor (X shr 30)) * UInt64($BF58476D1CE4E5B9);
  11.   Z := (Z xor (Z shr 27)) * UInt64($94D049BB133111EB);
  12.   Result := Z xor (Z shr 31);
  13. end;
  14.  
  15. begin
  16. end.

Much of the code already works, but I want the complete library to compile.

Hi Thaddy - thanks again for looking into this subject. Any news on the bugfix and status of your porting activity?

Regards,
MathMan

Thaddy

  • Hero Member
  • *****
  • Posts: 14358
  • Sensorship about opinions does not belong here.
Re: Laz/FPC version of Velthuis arbitrary precision package for Dephi
« Reply #6 on: April 30, 2019, 08:26:44 am »
The bug is still there. I will use the work-around and finish it.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018