mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 17:28:05 +02:00
35 lines
854 B
ObjectPascal
35 lines
854 B
ObjectPascal
{$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.
|