comparing doubles for equality
- From: John Smith <JSmith@xxxxxxxx>
- Date: Sat, 30 Dec 2006 22:56:40 GMT
This code for the comparison of fp types is taken from the C FAQ.
Any problems using it in a macro?
/* compare 2 doubles for equality */
#define DBL_ISEQUAL(a,b) (fabs((a)-(b))<=(DBL_EPSILON)*fabs((a)))
Do the same issues involved in comparing 2 fp types for equality
apply to comparing a float to zero? E.g. is if(x == 0.0) considered harmful?
.
- Follow-Ups:
- Re: comparing doubles for equality
- From: SM Ryan
- Re: comparing doubles for equality
- From: Thad Smith
- Re: comparing doubles for equality
- From: *** T. Winter
- Re: comparing doubles for equality
- From: Tim Prince
- Re: comparing doubles for equality
- Prev by Date: Re: MNC Hyderabad is Looking for C++ Developer...
- Next by Date: Good ways to analyze a running c-program?
- Previous by thread: good algorithms come with practice and reading good code/books?
- Next by thread: Re: comparing doubles for equality
- Index(es):