- Home /

# Trying to obtain sine/cosine by angles giving me imprecise values

From the code:

```
double senoDoAngulo=Mathf.Asin((30 * Mathf.PI) / 180);
print ("Angle Sin: "+senoDoAngulo);
```

I obtain as answer: Cos Do Angle Sin: 0.551069617271423, not 0.5 as should it be, someone knows why and how to fix it? Thanks.

It's working well for Sine but not Cossine:

```
print ("Sin "+Mathf.Sin(89 * Mathf.PI / 180));
print ("Cossine"+Mathf.Cos(89 * Mathf.PI / 180));
print ("Sin "+Mathf.Sin(90 * Mathf.PI / 180));
print ("Cossine"+Mathf.Cos(90 * Mathf.PI / 180));
print ("Sin "+Mathf.Sin(91 * Mathf.PI / 180));
print ("Cossine"+Mathf.Cos(91 * Mathf.PI / 180));
```

Sin 0.9998477 Cossine 0.01745238 Sin 1 Cossine -4.371139E-08 Sin 0.9998477 Cossine -0.01745247

**Answer** by unimechanic
·
Nov 05, 2014 at 02:24 PM

Could be a problem due to float type precision. Try the .NET Math library:

http://msdn.microsoft.com/en-us/library/system.math.cos%28v=vs.110%29.aspx

### 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.

### Follow this Question

### Related Questions

Getting cosinus of an angle in degrees 3 Answers

Projectiles won't fire correctly. Help! (C#) 1 Answer

Create line that splits triangle 1 Answer

RotateAround x degrees for every Time.deltaTime 0 Answers

calculus help angels of a triangle 1 Answer