# A formula to calculate the direction of a vector from 0 to 360 degrees.

The formula is working for any value of x and y, is not using any trigonometric function and give the result with an accuracy of one billionth of the degree.

f(x , y)=180/pi()*(pi()/8*sign(x*y)*sign(y^2-x^2)+pi()/4*(4-2*sign(y)-sign

(x*y))-pi()/2*(1-sign(y^2))*(sign(x^2)+sign(x))-
n=0
sign(x*y)*Σ(-1)^n*((abs(x)*(sqrt(2)-1)^(x^2-y^2)-abs(y)/
n=17
(abs(x)+abs(y)*(sqrt(2)-1)^(x^2-y^2)))^(2n+1)/(2n+1))

(thinking…) Signed in as (Sign out)

We’ll send you updates on this idea

## 1 comment

(thinking…) Signed in as (Sign out)
Submitting...
• In order to do some corrections i 'll rewrite the formula.

f(x, y)=180/pi()*(pi()/8*sign(x*y)*sign(y^2-x^2)+pi()/4*(4-2*sign(y)-sign(x*y))-pi()/2*(1-sign(y^2))*(sign(x^2)+sign(x))-
n=17
sign(x*y)*(Σ(-1)^n*((abs(x)*(sqrt(2)-1)^sign(x^2-y^2)-abs(y))/(abs(x)+abs(y)*(sqrt(2)-1)^sign
n=0
(x^2-y^2)))^(2*n+1)/(2*n+1

The accuracy of the formula is one billionth of a second of a degree.

The following is a version of the formula that is using the trigonometric function ATAN.

f(x, y)=180/pi()*(pi()/8*sign(x*y)*sign(y^2-x^2)+pi()/4*(4-2*sign(y)-sign(x*y))-pi()/2*(1-sign(y^2))*

(sign(x^2)+sign(x))-sjgn(x*y)*atan((abs(x)*(sqrt(2)-1)^sign(x^2-y^2)-abs(y))/

(abs(x)+abs(y)*(sqrt(2)-1)^sign(x^2-y^2))))