Directions from 0 to 2pi 1)atan(x,y) 2)atan(E,N) and from pi to +pi 3)atan2(x,y)
1)atan(x,y)=pipi/2*(1+sgn(x))*(1sgn(y^2))pi/4*(2+sgn(x))*sgn(y)
sign(x*y)*atan((abs(x)abs(y))/(abs(x)+abs(y))) when x=x2x1 ,y=y2y1
2)atan(E,N)=pipi/2*(1+sgn(N))*(1sgn(E^2))pi/4*(2+sgn(N))*sgn(E)
sgn(N*E)*atan((abs(N)abs(E))/(abs(N)+abs(E))) when N=N2N1 ,E=E2E1
3)atan2(x,y)=pi/2*(1sgn(x))*(1sgn(y^2))+pi/4*(2sgn(x))*sgn(y)
sgn(x*y)*atan((abs(x)abs(y))/(abs(x)+abs(y))) when x=x2x1 ,y=y2y1
The above fuctions give the directions in the 4 quadrans for all the pairs of dx and dy.
For dx=dy=0 the result is indefinite .
9 comments

Theodore Panagos commented
Mr Giannis
You are right, if you reverse the transformed formula to the initial, you find that
are missing some terms of variables. The missing terms are the following:
π/4*(2+2*sgn(x^2)+2*sgn(y^2)2*sgn(x^2*y^2))
The explanation is coming clear with the description of the transformation
steps of the first part of the initial formula.
π/4*(2*sgn(x)+2*sgn(x^2)2*sgn(y)+4*sgn(y^2)sgn(x*y)+2*sgn(x*y^2)
2*sgn(x^2*y^2))
=πππ/4*2*(sgn(x)sgn(x^2)2*sgn(y^2)sgn(x*y^2)+sgn(x^2*y^2))
π/4*(2*sgn(y)+sgn(x*y))
=ππ/2*(2+sgn(x)sgn(x^2)sgn(y^2)*(2+sgn(x)sgn(x^2)))π/4*(2+sgn(x))*sgn(y)
=ππ/2*(2+sgn(x)sgn(x^2))*(1sgn(y^2))π/4*(2+sgn(x))*sgn(y)
=ππ/2*(1+sgn(x)+1sgn(x^2))*(1sgn(y^2))π/4*(2+sgn(x))*sgn(y)The terms (1sgn(x^2)) are deleted because they have NOT ZERO value
only when x=y=0.This is not possible due to the second part of the formula.
sgn(x*y)*atan((abs(x)abs(y))/(abs(x)+abs(y)))
So finally the first part of the formula is:
ππ/2*(1+sgn(x))*(1sgn(y^2))π/4*(2+sgn(x))*sgn(y) 
[Deleted User] commented
i tried the function and it works, but i can't figure out why i don't get the appropriate results when i try to reverse the formula in order to get the initial variable

ΠΑΝΑΓΙΩΤΑ ΓΟΛΕΓΟΥ commented
CONGRATULATIONS!!! FOR IDEA AND APPLICATION.

Theodore Panagos commented
As per request of Mr Fotis i give a brief description of the derivation of the formula.
We consider the angle of a vector AB with the bisector of the quadrant.
That angle as we know from Trigonometry is given by the formula
f1(x,y)=atan((abs(x)abs(y))/(abs(x)+abs(y))),where x=xBxA and y=yByA.
We multiply the formula f1(x,y) with the sgn(x*y) and we have the formula
f(x,y)=sgn(x*y)*atan((abs(x)abs(y))/(abs(x)+abs(y))) that is positive
in the 1,3,5 and 7 octans,negative in the 2,4,6 and 8 octans,have zero value
in the directions n*π/4 when n=0,1,2,3,4,5,6 and 7 and is indefinite for x=y=0.There are eight semi lines with directions 0,1,2,3,4,5,6 and 7 multiply of π/4
and defined by the pairs of signs (1,0),(1,1),(0,1),(1,1),(1,0),(1,1),(0,1)
and (1,1) respectively.
We concider the sgn(x),sgn(y),sgn(x^2),sgn(y^2) and their pairs.
So because sgn(x*x^2)=sgn(x) and sgn(y*y^2)=sgn(y) there are finally the
below eight. sgn(x),sgn(x^2),sgn(y),sgn(y^2),sgn(x*y),sgn(x*y^2),sgn(y*x^2)
and sgn(x^2*y^2). We formate the equation .
(a1*sgn(x)+a2*sgn(x^2)+b1*sgn(y)+b2*sgn(y^2)+c1*sgn(x*y)+c2*sgn(x*y^2)
+c3*sgn(y*x^2)+c4*sgn(x^2*y^2))*π/4=n*π/4 where n=0,1,2,3,4,5,6 and 7
and the values of sgn(x),sgn(y) as above.
We form a system of 8 equations to find the values of a1,a2,b1,b2,c1,c2,c3
and c4.The result is a2=2, a1=2, b2=4, b1=2, c4=2, c3=0, c1=1 and c2=2
As per the above result when (x=xBxA and y=yByA) there is
atan(x,y)=π/4*(2*sgn(x)+2*sgn(x^2)2*sgn(y)+4*sgn(y^2)sgn(x*y)
+2*sgn(x*y^2)2*sgn(x^2*y^2)sgn(x*y)*atan((abs(x)abs(y))/(abs(x)+abs(y)))
and is transformed to
atan(x,y)=ππ/2*(1+sgn(x))*(1sgn(y^2))π/4*(2+sgn(x))*sgn(y)
sgn(x*y)*atan((abs(x)abs(y))/(abs(x)+abs(y)))

Fotis Giagamis commented
I tried the formula and it works flawlessly. It is a great upgrade over the current formula in speed and functionality, I have to say I was really surprised. How did you come up with this idea?

ARGYRW commented
it works without problems and overcomes the existing formula concerning the range of values. I hope it will attract enough attention, because it seems like a revolutionary idea in comparison with what we use right now

Theodore Panagos commented
In addition to atan(x,y) I give the formulas for asin(x,y) and acos(x,y) for the four
quadrants and for all the pairs dx,dy.1)asin(x,y)=pipi/2*(1+sgn(x))*(1sgn(y^2))pi/4*(2+sgn(x))*sgn(y)
sgn(x*y)*asin((abs(x)abs(y))/sqrt(2*x^2+2*y^2))
2)acos(x,y)=pipi/2*(1+sgn(x))*(1sgn(y^2))pi/4*(2+sgn(x))*sgn(y)
sgn(abs(x)abs(y))*sgn(x*y)*acos((abs(x)+abs(y))/sqrt(2*x^2+2*y^2))

Anonymous commented
Θθθθ

Theodore Panagos commented
That formula need no more than 3 cells to work in EXCEL. Need one for dx , one for dy and one
for the formula .