I want to compare two doubles a
and b
in C# (where for example b
has more decimal places) in the way that: if I round the number b
to number of decimal places of a
i should get the same number if they are the same. Example:
double a = 0.123;
double b = 0.1234567890;
should be same.
double a = 0.123457
double b = 0.123456789
should be same.
I cannot write
if(Math.Abs(a-b) < eps)
because I don't know how to calculate precision eps
.