blob: 016b1968ff0bf6a6a716ccb2036a4ddc1cf9aa36 (
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
|
{$mode objfpc}
type
float = double;
function ConvertRealToPixel(Axis : integer;
HelpReal : real) : real;
begin { function ConvertRealToPixel }
ConvertRealToPixel := HelpReal;
end; { function ConvertRealToPixel }
var
HelpFloat1,HelpFloat2,HelpFloat3 : float;
SegmentStartPos : float;
SegmentLength : float;
begin
SegmentStartPos := 0.5;
SegmentLength := 0.5;
HelpFloat1 := SegmentStartPos - SegmentLength / 2;
HelpFloat2 := ConvertRealToPixel(1,HelpFloat1);
writeln('Function result = ',HelpFloat2,' This is OK');
HelpFloat3 := ConvertRealToPixel(1,SegmentStartPos - SegmentLength / 2);
writeln('Function result = ',HelpFloat3,' THIS IS WRONG !');
if HelpFloat2<>HelpFloat3 then
begin
Writeln('ERROR!');
Halt(1);
end;
end.
|