Hi 7611172672,
The code that you posted and the requirements of calculating distances is not clear enough. We don't know if you are calculating distances for every point at 0.5 increments/decrements or if you already have a set of pre-defined points to calculate the distance to the destination. (i.e. you have a range of 3.682043 to 2.227804, however, your program will stop at 2.68204)
Right now, the best tool to make sure you code is running correctly is to use indicators for your variables to double-check the execution of your script. You can insert these variables at specific points in your program to help troubleshoot program flow:

Aldo A
Applications Engineer
National Instruments