approxEqual() has fooled me for a long time...

Basile B. via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 1 14:42:57 PDT 2016


On Monday, 1 August 2016 at 21:05:38 UTC, jmh530 wrote:
> On Monday, 1 August 2016 at 19:43:57 UTC, Basile B. wrote:
>>
>> Just a hint don't use approxEqual() to compare GUI object 
>> coordinates >!<
>
> It doesn't help that approxEqual basically just ignores 
> maxAbsDiff
>
> https://issues.dlang.org/show_bug.cgi?id=15881

My comment is mostly because the result are totally 
un-intuitives. It looks like **the function** you should use to 
un-stress a gui engine with realigning but...

unittest
{
     assert(approxEqual(1600.0f, 1600.1f)); // true
     assert(approxEqual(1.0f, 1.1f)); // false
}

is a source of hair-scratching, so in fine you don't use it.


More information about the Digitalmars-d mailing list