[fpc-pascal] Is there some binary packet for ARM version 2.2

Den Jean Den.Jean at telenet.be
Thu Nov 15 23:56:29 CET 2007


On Thursday 15 November 2007 05:35:06 pm Henry Vermaak wrote:
> there's an i386-win32 to arm-wince cross compiler on the download
> page.  the arm-linux one is native, so you'll have to build  your own
> cross compiler, if i'm not mistaken.

I just build a  cross fpc with svn 9263, but noticed
that the trigonometric functions fail.

It has been wrong before. Here is some old test code that I used
before to test it and that does not fail with the cross fpc available on the 
freepascal home page (version 2.0.4)


 
cat testtrig.pp:
program testtrig;

uses
{$IFDEF CPU86}
  CMem,
{$ENDIF}
  SysUtils,Math;

const

 dim = 36;
 MaxFloat = 1.1000000000000000E+4932;

 // from dcc
 sinus : array[1..dim] of double = (
 1.7364817766693035E-0001, 3.4202014332566873E-0001, 5.0000000000000000E-0001, 
6.4278760968653933E-0001,
 7.6604444311897804E-0001, 8.6602540378443865E-0001, 9.3969262078590838E-0001, 
9.8480775301220806E-0001,
 1.0000000000000000E+0000, 9.8480775301220806E-0001, 9.3969262078590838E-0001, 
8.6602540378443865E-0001,
 7.6604444311897804E-0001, 6.4278760968653933E-0001, 5.0000000000000000E-0001, 
3.4202014332566873E-0001,
 
1.7364817766693035E-0001,-5.4210108624275222E-0020,-1.7364817766693035E-0001,-3.4202014332566873E-0001,
-5.0000000000000000E-0001,-6.4278760968653933E-0001,-7.6604444311897804E-0001,-8.6602540378443865E-0001,
-9.3969262078590838E-0001,-9.8480775301220806E-0001,-1.0000000000000000E+0000,-9.8480775301220806E-0001,
-9.3969262078590838E-0001,-8.6602540378443865E-0001,-7.6604444311897804E-0001,-6.4278760968653933E-0001,
-5.0000000000000000E-0001,-3.4202014332566873E-0001,-1.7364817766693035E-0001, 
1.0842021724855044E-0019
 );

var
  i : integer;
  Delta,Ref,Value : Double;


const
  MaxErr = 1E-14;
  pi =  3.1415926535897932E+0000;


begin
for i:=1 to dim do
  begin
  // Generate constant array above output
  write(sin(i*10/180.0*pi),',');
  if i mod 4 = 0 then writeln;
  end;


writeln('Testing SIN');
for i:=1 to dim do
  begin
  Ref:=sinus[i];
  Value:=sin(i*10/180.0*pi);
  Delta := Value - Ref;
  if Abs(Delta) > MaxErr then
    begin
      writeln('  Error for Sin(',i*10,') was:',Value,' should be:',Ref) ;
//       halt(1);
    end;
  end;


writeln('Testing COS');
for i:=1 to dim do
  begin
  Ref := sin(pi/2-i*10/180*pi);
  Value := cos(i*10/180*pi);
  Delta := Value - Ref;
  if Abs(Delta) > MaxErr then
    begin
      writeln('  Error for Cos(',i*10,') was:',Value,' should be:',Ref) ;
//       halt(1);
    end;
  end;


writeln('Testing TAN');
for i:=1 to dim do
  begin
    if i=9 then Ref := MaxFloat
    else if i=27 then Ref := -Maxfloat
    else Ref:=sin(i*10/180*pi)/cos(i*10/180*pi);
    Value := tan(i*10/180*pi);
    Delta := Value - Ref;
    if Abs(Delta) > MaxErr then
      begin
        writeln('  Error for Tan(',i*10,') was:',Value,' should be:',Ref) ;
//         halt(1);
      end;
  end;


writeln('Testing ARCTAN...');
for i:=1 to 8 do
  begin
  Ref := i*10;
  Value := arctan(tan(i*10/180*pi))/pi*180;
  Delta := Value - Ref;
  if Abs(Delta) > MaxErr then
    begin
      writeln('  Error for ArcTan(',i*10,') was:',Value,' should be:',Ref);
//       halt(1);
    end;
  end;


for i:=-1 downto -8 do
  begin
  Ref := i*10;
  Value := arctan(tan(i*10/180*pi))/pi*180;
  Delta := Value - Ref;
  if Abs(Delta) > MaxErr then
    begin
      writeln('  Error for ArcTan(',i*10,') was:',Value,' should be:',Ref);
//       halt(1);
    end;
  end;

writeln('Tan +/- 90 deg test:');
writeln('tan(89.999):',tan(89.999/180*pi));
writeln('tan(90.000):',tan(90.000/180*pi));

writeln('tan(-89.999):',tan(-89.999/180*pi));
writeln('tan(-90.000):',tan(-90.000/180*pi));

writeln('ArcTan2 kwadrants:');
writeln('Kwadrant 1 ( 1, 1):',arctan2( 1, 1)/pi*180:5:1,' deg');
writeln('Kwadrant 2 (-1, 1):',arctan2( 1,-1)/pi*180:5:1,' deg');
writeln('Kwadrant 3 (-1,-1):',arctan2(-1,-1)/pi*180:5:1,' deg');
writeln('Kwadrant 4 ( 1,-1):',arctan2(-1, 1)/pi*180:5:1,' deg');

writeln('ArcTan2 special cases:');
writeln('Kwadrant X ( 0, 0):',arctan2( 0, 0)/pi*180:5:1,' deg');
writeln('Kwadrant 1 ( 1, 0):',arctan2( 0, 1)/pi*180:5:1,' deg');
writeln('Kwadrant 2 ( 0, 1):',arctan2( 1, 0)/pi*180:5:1,' deg');
writeln('Kwadrant 3 (-1, 0):',arctan2( 0,-1)/pi*180:5:1,' deg');
writeln('Kwadrant 4 ( 0,-1):',arctan2(-1, 0)/pi*180:5:1,' deg');



end.



More information about the fpc-pascal mailing list