- Home /
real life:sin(2Pi)=0 unity Mathf.Sin(2Pi)=1.748456E-07
I really don't understand what's going on here, I was making a light intensity change based sin that didn't want to work and I couldn't figure out what was wrong until i tried simply using Mathf.Sin to 2Pi.
print("feed sine("+(2*Mathf.PI)+")= "+Mathf.Sin(2*Mathf.PI));
feed sine(6.283185)= 1.748456E-07
am I missing something here? can someone tell me where unity sine reaches its loop point?
Comment
Best Answer
Answer by ejpaari · Mar 25, 2014 at 10:45 AM
If you are asking why it is not 0 it is about floating point accuracy. 1.748456E-07 is a number very close to zero and you should use epsilon when dealing with small floating point comparisons.