On Tue, 20 Sep 2011 00:17:37 -0700 (PDT) Michal Krol <mic...@vmware.com> wrote:
> ----- Original Message ----- > > On Sun, 11 Sep 2011 13:05:38 +0200, Tolga Dalman > > <tolga.dal...@googlemail.com> wrote: > > > Hi Kenneth, > > > > > > On Fri, 9 Sep 2011 14:41:45 -0700 > > > Kenneth Graunke <kenn...@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