- Home /
Question by
lam meng chun · Dec 29, 2010 at 03:58 AM ·
mathfcos
Unity3d how to make cos 90 equal to 0?
Mathf.Cos(90 * Mathf.Deg2Rad); give me the answer is -4.371139E-08 But i need it to be 0
Comment
By the way. 1.1234 how can i display number in above in 1.12 form, 2 decimal point.
Best Answer
Answer by Mike 3 · Dec 29, 2010 at 04:09 AM
That's the closest you'll get due to floating point imprecision. Check the answer I wrote here for a more detailed explaination:
http://answers.unity3d.com/questions/26450/mathf-sin-mathf-cos
I had check before. So it is need to convert into integer to get a 0?
Printing it to two decimal places should be enough. yourVal.ToString("F2")
Your answer
Follow this Question
Related Questions
Mathf.Sin() & Mathf.Cos() 1 Answer
radiusX and radiusY ? 1 Answer
Instantiate objects in an arc shape 1 Answer
Cos creates problems with addforce 0 Answers