[Development] Comparing two reals in Qt code

Samuel Rødal samuel.rodal at digia.com
Fri Nov 30 13:36:39 CET 2012


On 11/30/2012 09:51 AM, Jedrzej Nowacki wrote:
> On Friday 30. November 2012 09.23.32 Samuel Rødal wrote:
>> Yep, having something similar to AlmostEqualUlpsAndAbs() would be great.
>> I've had some ideas of making qFuzzyCompare work that way in the past,
>> but gave them up due to not wanting to risk subtly breaking a lot of
>> existing code. Introducing a new function, with default but customizable
>> arguments for the max differences, sounds like the way to go.
>>
>> The following tasks might be relevant:
>> https://bugreports.qt-project.org/browse/QTBUG-26453
>> https://bugreports.qt-project.org/browse/QTBUG-16819
>
> Hi,
>
>     Is qFuzzyCompare compatible with ECMAScript standard for float comparision?
> It would not be good if sometimes two, const floats are equals and somtimes
> not.

ECMAScript float comparison doesn't seem to be fuzzy, at least from what 
I can tell here: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3

--
Samuel



More information about the Development mailing list