I fixed the test so the near test now passes on 32bit. The test failures there now are something different.
About 'eps should be scaled': sure. That would be great. With the < to <= change I basically just did the smallest possible change in the implementation of near to make near(x,x) == True. But using abs(x-x0) < eps may be a better of the simple solutions. It should certainly make near(x,x) == True. Using relative error would be better but more expensive, and if somebody tries that they better read your linked article well and do a good job... Martin On 8 July 2011 13:10, Garth N. Wells <gn...@cam.ac.uk> wrote: > Here's an extensive discussion on comparing floats: > > http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm > > Garth > > On 08/07/11 11:44, Garth N. Wells wrote: >> >> >> On 08/07/11 11:33, Martin Sandve Alnæs wrote: >>> I already explained this, but let me make it clearer: >>> >>> If >>> x >> eps, >>> such that >>> x + eps == x, >>> then near(x, x) implemented as >>> x < x + eps >>> will be equivalent to >>> x < x >>> which is false. >>> >> >> eps should be scaled. >> >>> Clearly, near(x,x) should always be true in a correct implementation. >>> Using x <= x + eps fixes this. This is not "relying on equality", >>> that would be using ==. >>> >>> If you have a failing test case, show it to me and I will see what I can do. >>> >> >> See buildbot. >> >> Garth >> >>> Martin >>> >>> >>> On 8 July 2011 12:21, Garth N. Wells <gn...@cam.ac.uk> wrote: >>>> I think that this is a 'bug' in the test. Relying on equality (i.e. <= >>>> versus <) for non-integers will lead to problems somewhere (like the >>>> 32-bit buildbot failing). >>>> >>>> Garth >>>> >>>> >>>> On 08/07/11 09:23, nore...@launchpad.net wrote: >>>>> ------------------------------------------------------------ >>>>> revno: 6054 >>>>> committer: Martin Alnes <marti...@simula.no> >>>>> branch nick: work >>>>> timestamp: Fri 2011-07-08 10:20:54 +0200 >>>>> message: >>>>> Re-introduce bugfix in near after recent mistaken(?) re-introduction of >>>>> the bug, or something... Also disable debug print in test. >>>>> modified: >>>>> dolfin/math/basic.cpp >>>>> test/unit/math/python/basic.py >>>>> >>>>> >>>>> -- >>>>> lp:dolfin >>>>> https://code.launchpad.net/~dolfin-core/dolfin/main >>>>> >>>>> Your team DOLFIN Core Team is subscribed to branch lp:dolfin. >>>>> To unsubscribe from this branch go to >>>>> https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription >>>> >>>> _______________________________________________ >>>> Mailing list: https://launchpad.net/~dolfin >>>> Post to : dolfin@lists.launchpad.net >>>> Unsubscribe : https://launchpad.net/~dolfin >>>> More help : https://help.launchpad.net/ListHelp >>>> >> >> >> _______________________________________________ >> Mailing list: https://launchpad.net/~dolfin >> Post to : dolfin@lists.launchpad.net >> Unsubscribe : https://launchpad.net/~dolfin >> More help : https://help.launchpad.net/ListHelp > > _______________________________________________ > Mailing list: https://launchpad.net/~dolfin > Post to : dolfin@lists.launchpad.net > Unsubscribe : https://launchpad.net/~dolfin > More help : https://help.launchpad.net/ListHelp > _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp