This function will work the same way is the DB built-in function. Just for those who like to know how things work.
function atanful(x#, y#)
angle# = 90 - atan(y#/x#)
if x# = 0
if y# < 0 then angle# = 180
if y# > 0 then angle# = 0
endif
if x# < 0 then angle# = 180 + angle#
endfunction angle#
modified version
function atanful(x#, y#)
if x# < 0
angle# = 180 + angle#
exitfunction angle#
endif
if x# = 0
if y# < 0 then angle# = 180
if y# > 0 then angle# = 0
exitfunction angle#
endif
angle# = 90 - atan(y#/x#)
endfunction angle#