summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/numlib/tests/spege1te.pas
blob: 382c8f6d150b20624fc013dfcf50a374d3087ec4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
program spege1te;

uses
  typ,
  spe;

const
  fspe: array[1..20] of rfunc1r = (@speach, @spearc, @spears, @speash, @speath, @spebi0, @spebi1, @spebj0, @spebj1, @spebk0, @spebk1, @speby0, @speby1, @specoh, @speefc, @speerf, @spegam, @spelga, @spesih, @spetah);

  fnames =
    'speachspearcspearsspeashspeathspebi0spebi1spebj0spebj1spebk0' +
    'spebk1speby0speby1specohspeefcspeerfspegamspelgaspesihspetah';

var
  x:    ArbFloat;
  t, u: ArbInt;
  s, h: string;
  f:    rfunc1r;

begin
  s := ParamStr(1);
  u := (Pos(s, fnames) + 5) div 6;
  if u = 0 then
  begin
    writeln(s, ' (commandlineparameter 1) bestaat niet in SPE');
    halt;
  end;

  f := fspe[u];

  Write('program results ' + s + 'te ');
  case SizeOf(ArbFloat) of
    4: writeln('(single)');
    8: writeln('(double)');
    6: writeln('(real)');
  end;

  x := pi;
  Str(x, h);
  t := Length(h) - 1;

  writeln;
  writeln('': t div 2, 'x', '': t - length(s) div 2, s + '(x)');
  writeln;

  while not EOF do
  begin
    readln(x);
    writeln(x, ' ': 2, f(x));
  end;

end.
program spege1te;

uses
  typ,
  spe;

const
  fspe: array[1..20] of rfunc1r = (@speach, @spearc, @spears, @speash, @speath, @spebi0, @spebi1, @spebj0, @spebj1, @spebk0, @spebk1, @speby0, @speby1, @specoh, @speefc, @speerf, @spegam, @spelga, @spesih, @spetah);

  fnames =
    'speachspearcspearsspeashspeathspebi0spebi1spebj0spebj1spebk0' +
    'spebk1speby0speby1specohspeefcspeerfspegamspelgaspesihspetah';

var
  x:    ArbFloat;
  t, u: ArbInt;
  s, h: string;
  f:    rfunc1r;

begin
  s := ParamStr(1);
  u := (Pos(s, fnames) + 5) div 6;
  if u = 0 then
  begin
    writeln(s, ' (commandlineparameter 1) bestaat niet in SPE');
    halt;
  end;

  f := fspe[u];

  Write('program results ' + s + 'te ');
  case SizeOf(ArbFloat) of
    4: writeln('(single)');
    8: writeln('(double)');
    6: writeln('(real)');
  end;

  x := pi;
  Str(x, h);
  t := Length(h) - 1;

  writeln;
  writeln('': t div 2, 'x', '': t - length(s) div 2, s + '(x)');
  writeln;

  while not EOF do
  begin
    readln(x);
    writeln(x, ' ': 2, f(x));
  end;

end.