I always compares double
s like
double a = xxx, b = xxx;
if (fabs(a-b)< 1e5) ...
But I read some codes, they just use
if (a == b) ...
So is it valid to use ==
directly when comparing double
s? And I don't care the accuracy issue.
I always compares double
s like
double a = xxx, b = xxx;
if (fabs(a-b)< 1e5) ...
But I read some codes, they just use
if (a == b) ...
So is it valid to use ==
directly when comparing double
s? And I don't care the accuracy issue.
Copyright © 2021 Jogjafile Inc.