.net - What is the right way to check floating-point variables for exact value equality in c#? -
i need check if floating-point (double
) variable a
value equals floating-point (double
) variable b
value. know floating-point types don't have exact matches decimal values , such comparison not make "physical sense" still need check if values stored same binary point of view. using ==
operator ok in case?
if x
, y
both of type double
, x == y
if , if x
, y
binary-equivalent. so, if looking binary-equivalence, ==
want using.
Comments
Post a Comment