From kde-core-devel Tue Jun 23 05:52:18 2009 From: Oswald Buddenhagen Date: Tue, 23 Jun 2009 05:52:18 +0000 To: kde-core-devel Subject: Re: Review Request: KColorSpace::KHCY::KHCY(const & QColor) Message-Id: <20090623055218.GA3524 () ugly ! local> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=124573635106018 On Mon, Jun 22, 2009 at 07:15:39PM -0400, Michael Pyne wrote: > On Monday 22 June 2009 17:53:54 Michael Kreitzer wrote: > > I considered that as well. The only thing that worries me is IEEE 754 on > > x86 seems woefully unreliable for direct comparisons if you're not trying > > to do something very simple (e.g. prevent a divide by zero). > > In all fairness, floating point on pretty much any platform is not suitable > for comparing to equality with anything but 0.0. For floating point if you > must compare something being equal to another value you should allow some > tolerance (i.e. is it within 1e-5, not is it exactly equal to something). > I think the best answer in this case is to ensure as much as possible, > comparisons are done against 0.0 (i.e. don't do if (a == b), but do c = a - b; > if(c == 0.0) ) > i really have to wonder what the technical foundation of that idea is, because to me it doesn't make any sense.