[prev in list] [next in list] [prev in thread] [next in thread] 

List:       enlightenment-devel
Subject:    Re: [E-devel] [EGIT] [core/efl] master 01/02: fix warnings about double/float comparisons in eina ve
From:       Carsten Haitzler (The Rasterman) <raster () rasterman ! com>
Date:       2016-05-21 4:42:43
Message-ID: 20160521134243.61d22cc19faf24ad8600aa68 () rasterman ! com
[Download RAW message or body]

On Fri, 20 May 2016 13:55:36 +0100 Tom Hacohen <tom@osg.samsung.com> said:

> On 20/05/16 13:45, Carsten Haitzler wrote:
> >  /**
> > + * @def EINA_DOUBLE_EQUAL
> > + * Macro to compare 2 double floating point values and deal with precision
> > + * loss issues.
> > + *
> > + * @since 1.18
> > + */
> > +#define EINA_DOUBLE_EQUAL(x, y) \
> > +   (fabs((x) - (y)) <= (2.2204460492503131e-16) * fabs((x)))
> > +
> > +/**
> >   * @}
> >   */
> >
> >
> 
> Why are you multiplying the right part? I'd just do:
> 
> fabs((x) - (y)) < epsilon
> 
> where epsilon is the value you want it to be (maybe this one, maybe we 
> need to define EINA_EPSILON per platform, not sure).

because precision reduces the larger the number with floats/doubles... it's not
constant. :)

> --
> Tom.
> 
> ------------------------------------------------------------------------------
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    raster@rasterman.com


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic