It's not a bug, but likely thing that makes people think you are not a math addict ))
function RealDistance(x1,y1,x2,y2 : Double): Double;
begin
RealDistance := Sqrt(Sqr(Abs(x2-x1)) + Sqr(Abs(y2-y1)));
end;
function TriDistance(x1,y1,x2,y2 : Integer): Byte;
begin
TriDistance := Round(Sqrt(Sqr(Abs(x2-x1)) + Sqr(Abs(y2-y1))));
end;
Abs is not necessary here.