PBP doesn't have signed 16-bit (WORD) variables so the distance.15 is simply a way to determine if the value is negative. The equivalent code, if you have signed variables, would be:
Code:
    Distance = Target - Position

    IF Distance > 1790 THEN
       Distance = Distance - 3580
    Endif

    IF Distance < -1790 THEN
       Distance = Distance + 3580
    ENDIF
/Henrik.