[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Review Request: KColorSpace::KHCY::KHCY(const & QColor)
From:       Michael Pyne <mpyne () kde ! org>
Date:       2009-06-22 23:15:39
Message-ID: 200906221915.47132.mpyne () kde ! org
[Download RAW message or body]


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) )

Regards,
 - Michael Pyne

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic