- Home /

# Mathf.atan2 vs Vector2.SignedAngle

Which is the difference between Mathf.Atan2 and Vector2.SignedAngle? I was using both of them for a problem and they seems to give different answer, but when I searched on internet it gave me both of them for the solution of the same problem. Why?

**Answer** by Pangamini
·
Jan 29 at 03:40 PM

Well, obvious difference is in the input. Atan2's input is 2 floats / 1 vector, SignedAngle's input is 2 vectors;
Also, Atan2 returns **radians**, while SignedAngle returns **degrees**, perhaps that's the main problem?

You can see the SignedAngle implementation here

```
public static float Angle(Vector2 from, Vector2 to)
{
// sqrt(a) * sqrt(b) = sqrt(a * b) -- valid for real numbers
float denominator = Mathf.Sqrt(from.sqrMagnitude * to.sqrMagnitude);
if (denominator < kEpsilonNormalSqrt)
return 0F;
float dot = Mathf.Clamp(Dot(from, to) / denominator, -1F, 1F);
return Mathf.Acos(dot) * Mathf.Rad2Deg;
}
// Returns the signed angle in degrees between /from/ and /to/. Always returns the smallest possible angle
public static float SignedAngle(Vector2 from, Vector2 to)
{
float unsigned_angle = Angle(from, to);
float sign = Mathf.Sign(from.x * to.y - from.y * to.x);
return unsigned_angle * sign;
}
```

taken from HERE

Unity's Mathf.Atan2 simply calls and returns value of System.Math.Atan2, you can read about it HERE

Also notice that SignedAngle uses two transcendentals, Sqrt and Acos, while Atan2 is a single one. So I assume that Atan2 is approx. twice as fast, use that provided the other vector is the X axis (so you don't really need the second vector to be variable)

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.