2
0

tw1133.pp 854 B

12345678910111213141516171819202122232425262728293031323334
  1. {$mode objfpc}
  2. type
  3. float = double;
  4. function ConvertRealToPixel(Axis : integer;
  5. HelpReal : real) : real;
  6. begin { function ConvertRealToPixel }
  7. ConvertRealToPixel := HelpReal;
  8. end; { function ConvertRealToPixel }
  9. var
  10. HelpFloat1,HelpFloat2,HelpFloat3 : float;
  11. SegmentStartPos : float;
  12. SegmentLength : float;
  13. begin
  14. SegmentStartPos := 0.5;
  15. SegmentLength := 0.5;
  16. HelpFloat1 := SegmentStartPos - SegmentLength / 2;
  17. HelpFloat2 := ConvertRealToPixel(1,HelpFloat1);
  18. writeln('Function result = ',HelpFloat2,' This is OK');
  19. HelpFloat3 := ConvertRealToPixel(1,SegmentStartPos - SegmentLength / 2);
  20. writeln('Function result = ',HelpFloat3,' THIS IS WRONG !');
  21. if HelpFloat2<>HelpFloat3 then
  22. begin
  23. Writeln('ERROR!');
  24. Halt(1);
  25. end;
  26. end.