Setting divisions to 360, I think I was able to get it working the way you want by making the following changes.
Use Atan2.
Drop the conditional amount you are adding, and add div/2 all the time. Let Atan2 do this for you.
Multiply by (div/2)/ pi. Or make sure your units are correct. They seemed to be off by 2x.
The other changes shown in the picture are just to show some other ways of doing things.
You can do math on arrays and clusters. In many cases such, this allows you to have fewer wires and think in terms of points, rects, etc. I added a picture control to hover over to quickly get an easy to control input to the code.
I didn't use your pythag VI simply because I didn't have it. I deleted the file stuff to clarify the code.
Also, you can of course use integers if you like, but they are much more error prone, and in many cases aren't any faster. Similarly, using file I/O to load values rather than compute them will likely be hundreds or thousands of times slower than computing it.
Hope this helps.
http://www.chiefdelphi.com/forums/images/attach/png.gif