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

List:       mesa3d-dev
Subject:    Re: [Mesa-dev] Fixup: Use C++ style constant member functions for
From:       Tolga Dalman <tolga.dalman () googlemail ! com>
Date:       2011-09-20 8:05:45
Message-ID: 20110920100545.28a3baed () ibt959
[Download RAW message or body]

On Tue, 20 Sep 2011 00:17:37 -0700 (PDT)
Michal Krol <michal@vmware.com> wrote:

> ----- Original Message -----
> > On Sun, 11 Sep 2011 13:05:38 +0200, Tolga Dalman
> > <tolga.dalman@googlemail.com> wrote:
> > > Hi Kenneth,
> > > 
> > > On Fri,  9 Sep 2011 14:41:45 -0700
> > > Kenneth Graunke <kenneth@whitecape.org> wrote:
> > > 
> > > > -   if (reg->type == BRW_REGISTER_TYPE_F) {
> > > > -      return reg->imm.f == 0.0;
> > > > +   if (type == BRW_REGISTER_TYPE_F) {
> > > > +      return imm.f == 0.0;
> > > [...]
> > > > -   if (reg->type == BRW_REGISTER_TYPE_F) {
> > > > -      return reg->imm.f == 1.0;
> > > > +   if (type == BRW_REGISTER_TYPE_F) {
> > > > +      return imm.f == 1.0;
> > > 
> > > Shouldn't this rather be something like
> > > fabs(imm.f - 1.0) < std::numeric_limits<float>::eps() ?
> > > 
> > > Nevertheless, I like your patch.
> > 
> > I don't think so: (some variable equal to 1.0) * (1.0 + epsilon)
> > should
> > return (1.0 + epsilon), while your change would optimize that to
> > return
> > the variable's value of 1.0, right?  I wouldn't want to do that
> > without
> > some clear reason to.
> > 
> 
> And this is still the case since the optimisation applies for deltas that are \
> *less* than epsilon, not *less-or-equal* as you imply.


I wouldn't exactly call it 'optimisation' :) However, I feel a bit uneasy about using \
the == operator on float variables as this could lead to unexpected errors.

Best regards
Tolga Dalman
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

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