Search code examples
c#doubleexponential

Math Functions with a double that has a large Exponential


My Math:

double CosAngle = Math.Cos(radians);
double result = ((v * i) * CosAngle);

I have an issue with the radians if my input is 90 Degrees.

I get "6.12303176911189E-17" for the CosAngle which seems to not take into account that this number is 0.00000000000000000612303176911189!

What is it that I am missing? How can I force this calculation to work, taking into account the E-17 part of the double?


Solution

  • How many decimal places you want to show/see, just round it up. The small error arises because of limited number of decimal places of pi are used in calculation.