[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: Benoit Jacob <jacob.benoit.1 () gmail ! com>
Date: 2009-06-25 13:54:50
Message-ID: d9f848520906250654s377a8e6bi85a6535760303962 () mail ! gmail ! com
[Download RAW message or body]
2009/6/25 Oswald Buddenhagen <ossi@kde.org>:
> On Thu, Jun 25, 2009 at 03:06:26PM +0200, Benoît Jacob wrote:
>> *** Can I use qFuzzyCompare to check if a number is close to zero?
>>
>> Never use qFuzzyCompare directly to check whether a number is
>> approximately zero. Doing
>> qFuzzyCompare(p,0)
>> expands to
>> return (qAbs(p) <= 0);
>> which is an exact comparison, it's basically the same as "p == 0" !
>>
> fwiw, qt master has qFuzzyIsNull() (or some similar name).
ah, good thing. But I can see that it doesn't take a "reference" parameter:
static inline bool qFuzzyIsNull(double d)
{
return qAbs(d) <= 0.000000000001;
}
so it is suitable only in the special case that I describe at the end
of my email: when numbers that are negligible compared to 1, can be
considered negligible.
In a setting where one is dealing with numbers like 1e+10 already,
qFuzzyIsNull behaves like an exact comparison, which is no what's
wanted!
Yes in the constext of kcolorspaces.cpp it is what you want.
Benoit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic