'Preamble CONST Deg2Rad=360/(2*Pi) Dim Float Th,R,X,Y Sub Polar(x As Float,y As Float,opt As Integer) ' opt 0 = radians, Not 0=degrees If y=0 Then y=1e-6 'eliminates div zero errors R=SQR(X*X+Y*Y) Th=Atn(X/Y) If Y<0 Then Th=Th+Pi ElseIf X<0 Then Th=Th+2*Pi EndIf If opt then Th=Th*Deg2Rad EndIf 'here Th and R contain the polar co-ordinates End Sub Sub Rect(Th As Float,R As Float,opt As Integer) ' opt 0 = radians, Not 0=degrees If opt then Th=Th/Deg2Rad EndIf Y=R*(Cos(Th)) X=R*(Sin(Th)) 'here X and Y contain the rectangular co-ordinates End Sub