Microsoft Small Basic

Program Listing: CVS185
' SmallBasic Version 1.2
' Program: CartesianToPolar
' Changelog:
' Author: Pappa Lapub
' Website:
' ImportURL: http://smallbasic.com/program/?
' SBOnline: http://smallbasic-publicwebsite-dev.azurewebsites.net/Program/view.aspx?
' Extension: LitDev
' Comment:
'
' Variables:
' ToDo:
' ==============================================================================
' using an angle of 30°, tan(30°) = 1/sqrt(3)
x = 100
y = 100 / Math.SquareRoot(3)


_r = ""
_a = ""
path = Program.Directory +"\Math_Functions.sbsub" ' is a renamed SB-Exe with Sub Routines
incl = LDCall.Include(path)
If incl <> "" Then
LDCall.CallInclude(incl, "Math_CartesianToPolar") ' Name of the Sub to call
Else
TextWindow.Read()
Program.End()
EndIf

'' TEST
polar = LDMath.Convert2Radial(0,0, x,y)

TextWindow.WriteLine("x= "+ x)
TextWindow.WriteLine("y= "+ y)
TextWindow.WriteLine("")

TextWindow.WriteLine("r= "+ _r)
TextWindow.WriteLine(" (Test 'LDMath.Convert2Radial' = "+ polar[1] +")")

TextWindow.WriteLine("a= "+ _a)
TextWindow.WriteLine(" (Test 'LDMath.Convert2Radial' = "+ polar[2] +")")
TextWindow.WriteLine("")