[Interest] Is it a LGPLv3 infringement to copy paste qFuzzyCompare implementation
chgans at gna.org
Fri Jul 22 11:25:07 CEST 2016
On 22 July 2016 at 20:10, Benjamin TERRIER <b.terrier at gmail.com> wrote:
> My personal experience is that it will depend on the countries in
> which you develop
> and distribute your software.
> In France for instance software are protected by "author's rights" which implies
> that to be protected a piece of code must have some kind of creativity and/or
> originality. So my guess would be that according to French laws qFuzzyCompare
> cannot be protected and thus can be copy-pasted without infringing
> neither the law nor the LGPL.
> Note that this is only a guess as only judges can rule if a piece of
> code is original enough to be protected.
I was thinking along these lines too, now the thing is I'm French too... ;)
But I'm currently working in New Zealand for a US based company that
sell their products in quite a few countries.
To emphasize a bit more, my opinion was based on the fact that
qFuzzyCompare is both very small and that is not innovative
(prior-art). Citing Qt source code was just a way to justify a choice
amoong all the possibilities, plus as well i was trying to sensibilise
people to the Qt framework, hoping to raise some attention to it.
Since it not always a joy to have to re-invent the wheel all the
> If you want to be sure your best move is to contact the FSF or a
> lawyer specializing in copyright.
> 2016-07-22 5:00 GMT+02:00 Ch'Gans <chgans at gna.org>:
>> Hi there,
>> I've recently added a "bool FuzzyCompare(float f1, float f2)" function
>> to a proprietary software I'm currently paid to work on (this is plain
>> C++ project, it doesn't use the Qt framework at all).
>> Being a more-than-happy Qt user in my spare time I decided that I
>> would first checkout the qFuzzyCompare implementation since I consider
>> Qt developers as top-of-the-notch C++ wizards (no kidding and no
>> attempt to be nice with them).
>> I have added a comment to "my" implementation referring to the
>> implementation of "qFuzzyCompare" in Qt5 source code (along with ).
>> The 2 implementations look alike indeed (apart from using std::fabsf,
>> std::min, etc.. in place of qAbs, qMin, ...), since the fuzzy compare
>> is a well-known algorithm.
>> My reference to Qt5 was there to justify the use of the "magic
>> constant" 100000.f.
>> I was pointed out that there's a potential LGPLv3 license
>> infringement, although I understand where the FUD is coming from, I
>> think that it is OK to read LGPLv3 source code to get inspired as long
>> as you don't blindly copy/paste code (In my case i checked out quite a
>> few articles and forum threads before choosing the Qt way as the best
>> way to do it for my application).
>> So my question is actually very serious, in this particular case,
>> would this be considered as a LGPLv3 infringement of Qt5 to add this
>> to a piece of proprietary software:
>> // Taken from Qt5 source code, see
>> http://doc.qt.io/qt-5/qtglobal.html#qFuzzyCompare-1 and
>> // https://code.woboq.org/qt5/qtbase/src/corelib/global/qglobal.h.html#_ZL13qFuzzyCompareff
>> // And for the insomniacs:
>> bool FuzzyCompare(float f1, float f2)
>> return (::fabsf(f1 - f2) * 100000.0f <= std::min(::fabsf(f1),
>> For comparison purpose, here is the Qt source code:
>> Q_DECL_CONSTEXPR static inline bool qFuzzyCompare(float p1, float p2)
>> return (qAbs(p1 - p2) * 100000.f <= qMin(qAbs(p1), qAbs(p2)));
>> You can find many more implementations of this algorithm on
>> stack-overflow and other forums.
>> At the end, I proposed to change the comments to refer to wikipedia
>> instead of Qt5 source code and saying that 100000.0f is the right
>> value for epsilon.
>> I know this is a drop in an ocean (we're talking 1 line of C++), but i
>> think the question is indeed interesting. Thanks for shedding light on
>> this particular issue.
>>  https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
>> Interest mailing list
>> Interest at qt-project.org
More information about the Interest