digitalmars.D - Re: float equality
- Kagamin <spam here.lot> Feb 21 2011
- "Robert Jacques" <sandford jhu.edu> Feb 21 2011
bearophile Wrote:Jonathan M Davis:The thing is, of course, that actual equality sucks for floating point values.
So much, that some people have proposed to deprecate the normal FP equality. MISRA-C disallows them. When you see a == among FP values is often a code smell.
Is it safe to assert that noone needs exact FP comparison?
Feb 21 2011
On Mon, 21 Feb 2011 10:15:28 -0500, Kagamin <spam here.lot> wrote:bearophile Wrote:Jonathan M Davis:The thing is, of course, that actual equality sucks for floating
So much, that some people have proposed to deprecate the normal FP equality. MISRA-C disallows them. When you see a == among FP values is often a code smell.
Is it safe to assert that noone needs exact FP comparison?
Nope. if(var == 0) is a common, important and valid test. To say nothing of testing for sentinel values.
Feb 21 2011