Lazarus

Free Pascal => Beginners => Topic started by: BobDog on August 04, 2022, 01:39:17 pm

Title: Complex numbers from windows (10)
Post by: BobDog on August 04, 2022, 01:39:17 pm

These are all built into ucrtbase.dll, so I had little work to do.
Code: Pascal  [Select][+][-]
  1.  
  2.   Type  
  3.   complex = record
  4.   re:double;
  5.   im:double;
  6.   end;
  7.  
  8.   type aoc=array of complex;
  9.  
  10.   var decplaces:integer=7;
  11.    
  12.  Function ccos(x:complex):complex;Cdecl external 'ucrtbase.dll' name 'ccos';  //cosine
  13.  Function csin(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'csin'; //sine
  14.  Function ctan(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'ctan'; //tan
  15.  Function clog(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'clog'; //log bese e
  16.  Function clog10(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'clog10'; //log base 10
  17.  Function carccos(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'cacos'; //arc cosine
  18.  Function carcsin(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'casin'; //arc sine
  19.  Function carctan(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'catan'; //arc tan
  20.  Function cexp(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'cexp';  //exp
  21.  Function cabs(x:complex):double; Cdecl external 'ucrtbase.dll' name 'cabs';   // absolute (modulus)
  22.  Function cpow(x:complex;p:complex):complex; Cdecl external 'ucrtbase.dll' name 'cpow'; //power
  23.  Function csqrt(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'csqrt'; //square root
  24.  Function conj(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'conj'; // conjugate
  25.  Function carg(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'carg'; // argument (phase angle)
  26.  Function cimag(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'cimag'; // imaginary part
  27.  Function creal(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'creal'; // real part
  28.  Function cproj(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'cproj'; // projection onto the Riemann sphere
  29.  Function ccosh(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'ccosh'; // hyperbolic cosine
  30.  Function csinh(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'csinh'; // hyperbolic sine
  31.  Function ctanh(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'ctanh'; // hyperbolic tan
  32.  Function carccosh(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'cacosh'; // inverse hyperbolic cosine
  33.  Function carcsinh(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'casinh'; // inverse hyperbolic sine
  34.  Function carctanh(x:complex):complex; Cdecl external 'ucrtbase.dll' name 'catanh'; // inverse hyperbolic tan
  35.  function sprintf(s:pchar;mask:pchar):integer; cdecl; varargs; external 'msvcrt.dll' name 'sprintf';
  36.  function pow(x:double;p:double):double;Cdecl external 'ucrtbase.dll' name 'pow'; //power(doubles)
  37.  function atan2(x:double;y:double):double;Cdecl external 'ucrtbase.dll' name 'atan2';
  38.  
  39. operator + (n1:complex;n2:complex) t :complex;
  40. begin
  41.  t.re:=  n1.re+n2.re;
  42.  t.im:= n1.im+n2.im;
  43.  exit(t);
  44. end ;
  45.  
  46. operator -(n1:complex;n2:complex) t:complex;
  47. begin
  48.  t.re:=  n1.re-n2.re;
  49.  t.im:= n1.im-n2.im;
  50.  exit(t);
  51. end;
  52.  
  53. operator *(n1:complex;n2:complex) t:complex;
  54. begin
  55.  t.re:= n1.re*n2.re - n1.im*n2.im;
  56.  t.im:= n1.im*n2.re + n1.re*n2.im;
  57.  exit(t);
  58. end;
  59.  
  60. operator /(n1:complex;n2:complex) t:complex;
  61.    var
  62. d:double;
  63. begin
  64.  d:= n2.re*n2.re+n2.im*n2.im;
  65.  t.re:= (n1.re*n2.re+n1.im*n2.im)/d;
  66.  t.im:= (n1.im*n2.re - n1.re*n2.im)/d;
  67.  exit(t);
  68. end;
  69.  
  70. operator ** (n1:complex;n2:complex) t:complex;
  71. begin
  72. exit (cpow(n1,n2));
  73. end;
  74.  
  75. operator **(n1:double;n2:double) t:double;
  76. begin
  77. exit(pow(n1,n2));
  78. end;
  79.  
  80. function CX(const x,y:double):complex;
  81.   var
  82.   c:complex;
  83.   begin
  84.   c.re:=x;c.im:=y;
  85.   exit(c)
  86.   end;
  87.  
  88.  
  89. function GetRoots(N:complex;numroots:Integer;var a:aoc):boolean;
  90.  Function Root(Z:Complex;N:Integer;k :Integer):Complex;
  91.   var
  92.   p:complex;
  93.     begin
  94.     If ((N <= 0) Or (K < 0) Or (K >= N)) Then exit (CX(0,0));
  95.     If ((cabs(Z)**(1/N))=0) Or ((cabs(Z)**(1/N))<0) Then exit (CX(0,0));
  96.     p.re:=(cabs(Z)**(1/N))*cos(((atan2(Z.im,z.re)+K*6.283185307179586)/N));
  97.     p.im:=(cabs(Z)**(1/N))*sin(((atan2(Z.im,z.re)+K*6.283185307179586)/N));
  98.     exit(p);
  99. End;
  100.  
  101. var
  102. check:complex;
  103. counter:integer;
  104. tolerance:double;
  105. begin
  106. tolerance:=cabs(n)/100;
  107. if (numroots mod 2=0) then check:=CX(-1,0);
  108. if (numroots mod 2=1) then check:=CX(1,0);
  109. setlength(a,numroots);
  110.     For counter:=0 To numroots-1 do
  111.     begin
  112.     a[counter]:=root(n,numroots,counter);
  113.         check:=check*a[counter];
  114.     end;
  115.     if abs(cabs(check)-cabs(N))<tolerance then exit(true);
  116.     exit(false);
  117. End;
  118.  
  119.  
  120. Function CRound(x:Double;precision:Integer):String;
  121. var
  122. z:string[40];
  123. s,ab:ansistring;
  124. ss:pchar;
  125. t:word=0;
  126. d:double;
  127. begin
  128. str(precision,ab);
  129. s:='%.'+ab+'f';
  130. ss:=@z[1];
  131.     If (precision>30) Then precision:=30;
  132.     sprintf(ss,pchar(s),x);
  133.     val(ss,d,t);
  134.     if(d=0) or (ss='') then ss:='0';
  135.     exit(ss);
  136. End;
  137.  
  138. procedure print(c:complex);
  139. var
  140. gap,sr:string;
  141. begin
  142. sr:=cround(c.re,decplaces);
  143. gap:=StringOfChar(' ',(decplaces+15)-length(sr));
  144. writeln(cround(c.re,decplaces),gap,cround(c.im,decplaces),'*i');
  145. end;
  146.  
  147.  
  148. var
  149. pi:double=3.141592653589793;
  150. ac:aoc=nil;
  151. bool:boolean;
  152. c1,c2:complex;
  153.  j:integer;
  154.  begin
  155.  randomize;
  156.  decplaces:=5;
  157.  
  158.  writeln('Euler''s formula -- e^(i*pi) + 1 =0 ');
  159.  print(cexp(CX(0,1)*CX(pi,0))+CX(1,0));
  160.  writeln;
  161.  writeln('cos(x)^2 +sin(x)^2 = 1');
  162.  print((ccos(cx(-7,5))**cx(2,0))+(csin(cx(-7,5))**cx(2,0)));
  163.  writeln;
  164.  writeln('cosh(x)^2 -sinh(x)^2 = 1');
  165.   print((ccosh(cx(-7,5))**cx(2,0))-(csinh(cx(-7,5))**cx(2,0)));
  166.   writeln;
  167.  bool:=GetRoots(CX(1,0),3,ac);
  168.  writeln('cube roots of unity');
  169.  if bool then
  170.  begin
  171.  for j:=0 to high(ac) do
  172.  begin
  173.  write('root ',j+1,' = ');
  174.  print(ac[j]);
  175.  end;
  176.  end;
  177.  writeln;
  178.  
  179. write('i^i  =  ');
  180.  print(CX(0,1)**CX(0,1));
  181.  
  182.  c1:=CX(random*10-random*10,random*10-random*10);
  183.  c2:=c1**CX(7,0);
  184.  write('Random number =  ');
  185.  print(c1);
  186.  write('Random number^7  =  ');
  187.  print(c2);
  188.  write('Seven roots of      ');print(c2);
  189.   bool:=GetRoots(c2,7,ac);
  190.   if bool then
  191.  begin
  192.  for j:=0 to high(ac) do
  193.  begin
  194.  write('root ',j+1,'  =   ');
  195.  print(ac[j]);
  196.  end;
  197.  end;
  198.  
  199.  writeln('Press return to finish . . .');
  200.  readln;
  201.  end.
  202.  
  203.  

For mode delphi I think the operators have a different format, but I have used no mode or external units, just what's there already in win 10.

Title: Re: Complex numbers from windows (10)
Post by: wp on August 04, 2022, 01:44:32 pm
Why do you chain yourself to a Windows dll when FPC has a built-in cross-platform complex numbers unit, ucomplex?:
Code: Pascal  [Select][+][-]
  1.   interface
  2.  
  3. {$ifndef FPUNONE}
  4.     uses math;
  5.  
  6.     type complex = record
  7.                      re : real;
  8.                      im : real;
  9.                    end;
  10.  
  11.     pcomplex = ^complex;
  12.  
  13.     const i : complex = (re : 0.0; im : 1.0);
  14.           _0 : complex = (re : 0.0; im : 0.0);
  15.  
  16.  
  17.     { assignment overloading is also used in type conversions
  18.       (beware also in implicit type conversions)
  19.       after this operator any real can be passed to a function
  20.       as a complex arg !! }
  21.  
  22.     operator := (r : real) z : complex;
  23.     {$ifdef TEST_INLINE}
  24.     inline;
  25.     {$endif TEST_INLINE}
  26.  
  27.     { operator := (i : longint) z : complex;
  28.       not needed because longint can be converted to real }
  29.  
  30.  
  31.     { four operator : +, -, * , /  and comparison = }
  32.     operator + (z1, z2 : complex) z : complex;
  33.     {$ifdef TEST_INLINE}
  34.     inline;
  35.     {$endif TEST_INLINE}
  36.  
  37.     { these ones are created because the code
  38.       is simpler and thus faster }
  39.     operator + (z1 : complex; r : real) z : complex;
  40.     {$ifdef TEST_INLINE}
  41.     inline;
  42.     {$endif TEST_INLINE}
  43.  
  44.     operator + (r : real; z1 : complex) z : complex;
  45.     {$ifdef TEST_INLINE}
  46.     inline;
  47.     {$endif TEST_INLINE}
  48.  
  49.  
  50.     operator - (z1, z2 : complex) z : complex;
  51.     {$ifdef TEST_INLINE}
  52.     inline;
  53.     {$endif TEST_INLINE}
  54.  
  55.     operator - (z1 : complex;r : real) z : complex;
  56.     {$ifdef TEST_INLINE}
  57.     inline;
  58.     {$endif TEST_INLINE}
  59.  
  60.     operator - (r : real; z1 : complex) z : complex;
  61.     {$ifdef TEST_INLINE}
  62.     inline;
  63.     {$endif TEST_INLINE}
  64.  
  65.  
  66.     operator * (z1, z2 : complex) z : complex;
  67.     {$ifdef TEST_INLINE}
  68.     inline;
  69.     {$endif TEST_INLINE}
  70.  
  71.     operator * (z1 : complex; r : real) z : complex;
  72.     {$ifdef TEST_INLINE}
  73.     inline;
  74.     {$endif TEST_INLINE}
  75.  
  76.     operator * (r : real; z1 : complex) z : complex;
  77.     {$ifdef TEST_INLINE}
  78.     inline;
  79.     {$endif TEST_INLINE}
  80.  
  81.  
  82.     operator / (znum, zden : complex) z : complex;
  83.     {$ifdef TEST_INLINE}
  84.     inline;
  85.     {$endif TEST_INLINE}
  86.  
  87.     operator / (znum : complex; r : real) z : complex;
  88.     {$ifdef TEST_INLINE}
  89.     inline;
  90.     {$endif TEST_INLINE}
  91.  
  92.     operator / (r : real; zden : complex) z : complex;
  93.     {$ifdef TEST_INLINE}
  94.     inline;
  95.     {$endif TEST_INLINE}
  96.  
  97.     { ** is the exponentiation operator }
  98.     operator ** (z1, z2 : complex) z : complex;
  99.     {$ifdef TEST_INLINE}
  100.     inline;
  101.     {$endif TEST_INLINE}
  102.  
  103.     operator ** (z1 : complex; r : real) z : complex;
  104.     {$ifdef TEST_INLINE}
  105.     inline;
  106.     {$endif TEST_INLINE}
  107.  
  108.     operator ** (r : real; z1 : complex) z : complex;
  109.     {$ifdef TEST_INLINE}
  110.     inline;
  111.     {$endif TEST_INLINE}
  112.  
  113.  
  114.     operator = (z1, z2 : complex) b : boolean;
  115.     {$ifdef TEST_INLINE}
  116.     inline;
  117.     {$endif TEST_INLINE}
  118.  
  119.     operator = (z1 : complex;r : real) b : boolean;
  120.     {$ifdef TEST_INLINE}
  121.     inline;
  122.     {$endif TEST_INLINE}
  123.  
  124.     operator = (r : real; z1 : complex) b : boolean;
  125.     {$ifdef TEST_INLINE}
  126.     inline;
  127.     {$endif TEST_INLINE}
  128.  
  129.     operator - (z1 : complex) z : complex;
  130.     {$ifdef TEST_INLINE}
  131.     inline;
  132.     {$endif TEST_INLINE}
  133.  
  134.     function cinit(_re,_im : real) : complex;inline;
  135.     function csamevalue(z1, z2 : complex) : boolean;
  136.  
  137.     { complex functions }
  138.     function cong (z : complex) : complex;      { conjuge }
  139.  
  140.     { inverse function 1/z }
  141.     function cinv (z : complex) : complex;
  142.  
  143.     { complex functions with real return values }
  144.     function cmod (z : complex) : real;           { module }
  145.     function carg (z : complex) : real;           { argument : a / z = p.e^ia }
  146.  
  147.     { fonctions elementaires }
  148.     function cexp (z : complex) : complex;       { exponential }
  149.     function cln (z : complex) : complex;        { natural logarithm }
  150.     function csqr (z: complex) : complex;        { square }
  151.     function csqrt (z : complex) : complex;      { square root }
  152.  
  153.     { complex trigonometric functions  }
  154.     function ccos (z : complex) : complex;       { cosinus }
  155.     function csin (z : complex) : complex;       { sinus }
  156.     function ctg  (z : complex) : complex;       { tangent }
  157.  
  158.     { inverse complex trigonometric functions }
  159.     function carc_cos (z : complex) : complex;   { arc cosinus }
  160.     function carc_sin (z : complex) : complex;   { arc sinus }
  161.     function carc_tg  (z : complex) : complex;   { arc tangent }
  162.  
  163.     { hyperbolic complex functions }
  164.     function cch (z : complex) : complex;        { hyperbolic cosinus }
  165.     function csh (z : complex) : complex;        { hyperbolic sinus }
  166.     function cth (z : complex) : complex;        { hyperbolic tangent }
  167.  
  168.     { inverse hyperbolic complex functions }
  169.     function carg_ch (z : complex) : complex;    { hyperbolic arc cosinus }
  170.     function carg_sh (z : complex) : complex;    { hyperbolic arc sinus }
  171.     function carg_th (z : complex) : complex;    { hyperbolic arc tangente }
  172.  
  173.     { functions to write out a complex value }
  174.     function cstr(z : complex) : string;
  175.     function cstr(z:complex;len : integer) : string;
  176.     function cstr(z:complex;len,dec : integer) : string;
  177.  
Title: Re: Complex numbers from windows (10)
Post by: BobDog on August 04, 2022, 02:00:42 pm

These errors were all down to me alone!
Title: Re: Complex numbers from windows (10)
Post by: marcov on August 04, 2022, 02:01:56 pm
So..... where is test.pas ?

Posting error messages without source is kind of pointless
Title: Re: Complex numbers from windows (10)
Post by: BobDog on August 04, 2022, 02:12:46 pm

Marcov
I asked for a simple example.
I don't know how to get from wp's code to a running test.
I ran wp's code, removing the interface keyword, and put
begin
end.
at the end.
I'll remove most of these errors from the thread now to save clutter.

Title: Re: Complex numbers from windows (10)
Post by: marcov on August 04, 2022, 02:16:15 pm
Wp's code is the interface of the unit in FPC. It is not for copy pasting.

Just add ucomplex to the USES portion of your project.

Usage is simple, just declare "complex" types and use the provided functions.
Title: Re: Complex numbers from windows (10)
Post by: BobDog on August 04, 2022, 02:37:17 pm

Fixed now thank you.

Title: Re: Complex numbers from windows (10)
Post by: wp on August 04, 2022, 02:43:50 pm
This works, guaranteed. Tested:
Code: Pascal  [Select][+][-]
  1. program Project1;
  2.  
  3. uses
  4.   uComplex;
  5. const
  6.   L = 0;
  7.   D = 3;
  8. var
  9.   c1, c2: complex;
  10. begin
  11.   c1 := cinit(1.0, 1.0);
  12.   c2 := cinit(2.0, -2.0);
  13.   WriteLn('c1      = ' + cstr(c1, L, D));
  14.   WriteLn('c2      = ' + cstr(c2, L, D));
  15.   WriteLn('c1+c2   = ' + cstr(c1+c2, L, D));
  16.   WriteLn('c1-c2   = ' + cstr(c1-c2, L, D));
  17.   WriteLn('c1*c2   = ' + cstr(c1*c2, L, D));
  18.   WriteLn('c1/c2   = ' + cstr(c1/c2, L, D));
  19.   WriteLn('sin(c1) = ' + cstr(csin(c1), L, D));
  20.   ReadLn;
  21. end.
Title: Re: Complex numbers from windows (10)
Post by: AlexTP on August 04, 2022, 02:49:40 pm
We have the forgotten page with sample!
https://wiki.freepascal.org/complex_number
Title: Re: Complex numbers from windows (10)
Post by: MarkMLl on August 04, 2022, 02:51:17 pm
I asked for a simple example.
I don't know how to get from wp's code to a running test.
I ran wp's code, removing the interface keyword, and put
begin
end.
at the end.

Chopping out random lumps of brain to find out what stops working is no longer an approved research technique.

There's a minimal example in 3.2.2/tests/test/units/ucomplex

...and I suggest next time giving people more than 16 minutes to answer before admitting to self-inflicted errors.

MarkMLl
Title: Re: Complex numbers from windows (10)
Post by: BobDog on August 04, 2022, 03:04:39 pm

OK I have it now.
Just use the functions and operators, no need to declare them (as per in a dll)
OK MarkML.
No need for any reprimands I would suggest.
I post my things in beginners in good faith, and I ask legitimate beginner's questions, I don't have a stop watch.

Title: Re: Complex numbers from windows (10)
Post by: BobDog on August 04, 2022, 04:56:37 pm
Here it is using ucomplex.
Code: Pascal  [Select][+][-]
  1.  
  2.  program testcplex;
  3. uses
  4. ucomplex,math;
  5.  
  6. type aoc=array of complex;
  7.  
  8.   var decplaces:integer=7;
  9.  
  10. function GetRoots(N:complex;numroots:Integer;var a:aoc):boolean;
  11.  Function Root(Z:Complex;N:Integer;k :Integer):Complex;
  12.   var
  13.   p:complex;
  14.     begin
  15.     If ((N <= 0) Or (K < 0) Or (K >= N)) Then exit (cinit(0,0));
  16.     If ((cmod(Z)**(1/N))=0) Or ((cmod(Z)**(1/N))<0) Then exit (cinit(0,0));
  17.     p.re:=(cmod(Z)**(1/N))*cos(((arctan2(Z.im,z.re)+K*6.283185307179586)/N));
  18.     p.im:=(cmod(Z)**(1/N))*sin(((arctan2(Z.im,z.re)+K*6.283185307179586)/N));
  19.     exit(p);
  20. End;
  21.  
  22. var
  23. check:complex;
  24. counter:integer;
  25. tolerance:double;
  26. begin
  27. tolerance:=cmod(n)/100;
  28. if (numroots mod 2=0) then check:=cinit(-1,0);
  29. if (numroots mod 2=1) then check:=cinit(1,0);
  30. setlength(a,numroots);
  31.     For counter:=0 To numroots-1 do
  32.     begin
  33.     a[counter]:=root(n,numroots,counter);
  34.         check:=check*a[counter];
  35.     end;
  36.     if abs(cmod(check)-cmod(N))<tolerance then exit(true);
  37.     exit(false);
  38. End;
  39.  
  40.  
  41. var
  42. pi:double=3.141592653589793;
  43. ac:aoc=nil;
  44. bool:boolean;
  45. c1,c2:complex;
  46.  j:integer;
  47.  begin
  48.  randomize;
  49.  decplaces:=5;
  50.  
  51.  writeln('Euler''s formula -- e^(i*pi) + 1 =0 ');
  52.  writeln(cstr(cexp(i*cinit(pi,0))+cinit(1,0),1,decplaces));
  53.  writeln;
  54.  writeln('cos(x)^2 +sin(x)^2 = 1');
  55.  writeln(cstr((ccos(cinit(-7,5))**cinit(2,0))+(csin(cinit(-7,5))**cinit(2,0)),1,decplaces));
  56.  writeln;
  57.  writeln('cosh(x)^2 -sinh(x)^2 = 1');
  58.   writeln(cstr((cch(cinit(-7,5))**cinit(2,0))-(csh(cinit(-7,5))**cinit(2,0)),1,decplaces));
  59.   writeln;
  60.  bool:=GetRoots(cinit(1,0),3,ac);
  61.  writeln('cube roots of unity');
  62.  if bool then
  63.  begin
  64.  for j:=0 to high(ac) do
  65.  begin
  66.  write('root ',j+1,' = ');
  67.  writeln(cstr(ac[j],1,decplaces));
  68.  end;
  69.  end;
  70.  writeln;
  71.  
  72.  write('i^i  =  ');
  73.  writeln(cstr(cinit(0,1)**cinit(0,1),1,decplaces));
  74.  
  75.  c1:=cinit(random*10-random*10,random*10-random*10);
  76.  c2:=c1**cinit(7,0);
  77.  write('Random number =  ');
  78.  writeln(cstr(c1,1,decplaces));
  79.  write('Random number^7  =  ');
  80.  writeln(cstr(c2,1,decplaces));
  81.  write('Seven roots of      ');
  82.  writeln(cstr(c2,1,decplaces));
  83.   bool:=GetRoots(c2,7,ac);
  84.   if bool then
  85.  begin
  86.  for j:=0 to high(ac) do
  87.  begin
  88.  write('root ',j+1,'  =   ');
  89.  writeln(cstr(ac[j],1,decplaces));
  90.  end;
  91.  end;
  92.  
  93.  
  94.  writeln('Press return to finish . . .');
  95.  readln;
  96.  end.
  97.  
  98.  
  99.  
  100.  
Thank you all
Title: Re: Complex numbers from windows (10)
Post by: MarkMLl on August 04, 2022, 05:14:20 pm
:-) Having got this far, is there anything you feel is missing from the FPC library that's provided by the Windows DLL, or did you just not know about it?

MarkMLl
Title: Re: Complex numbers from windows (10)
Post by: AlexTP on August 04, 2022, 05:49:52 pm
You don't need the 'CX' function, 'ucomplex' gives the 'cinit' function for that.

function CX(const x,y:double):complex;
Title: Re: Complex numbers from windows (10)
Post by: BobDog on August 04, 2022, 07:12:14 pm

Thanks AlexTP, I have renamed everything and retired my CX function.
MarkMLI
I suppose the vast number of external pascal pre written units would cover many of the dll exports.
I know about ucomplex now, and I like it.




Title: Re: Complex numbers from windows (10)
Post by: MarkMLl on August 04, 2022, 08:44:03 pm

Thanks AlexTP, I have renamed everything and retired my CX function.
MarkMLI
I suppose the vast number of external pascal pre written units would cover many of the dll exports.
I know about ucomplex now, and I like it.

The problem with the DLL export is that it's very much Windows- (hence also Intel/AMD-) specific... in fact is probably tied fairly tightly to a small range of versions. So /particularly/ since you've already put effort into the translation, if you see anything notable it's worth commenting.

Just in case: note that there's an FFTW interface with FPC, although when I last looked some target combinations lacked the prerequisite library so I ended up (also) transcribing a simple alternative implementation.

MarkMLl
TinyPortal © 2005-2018