Review Request: KColorSpace::KHCY::KHCY(const & QColor)	constructor floating point precision error
    Michael Pyne 
    mpyne at kde.org
       
    Tue Jun 23 00:15:39 BST 2009
    
    
  
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090622/8b6b1926/attachment.sig>
    
    
More information about the kde-core-devel
mailing list