double deg=90;
double two= 2* System.Math.PI;
double rad=(two)*(deg/360);
the original value when calculating manually ,rad is 1.5707963267948966 but rad shows when debugging is 1.5707963705062866 what is reason for this and how do i fix it.but correct answer is manual calculation answer only……
Here are the numbers for easier comparison:
1.5707963267948966
1.5707963705062866
--------- <-- differences
during the debug i put the pointer in right side that means calculation side it shows correct answer but the error happen when storing that value to rad.
is anybody help for me.i need it.
Rounding errors happen; it isn’t infinite precision. You will have to test whether values are suitably close – don’t just test for equality. In some cases you might also see subtle differences by applying the operators in a different sequence, so you don’t swamp small numbers with magnitude.