← Back to team overview

yade-dev team mailing list archive

Re: Mathr::ZERO_TOLERANCE vs Mathr::EPSILON

 

As for history/archeology, it looks like Vaclav introduced this code [*] (completing the previous commit [**])

I'd thus propose to get rid of ZERO_TOLERANCE at least, replacing with EPSILON where it is currently used.


Thoughts ?


(As for me, tolerance would for instance be  useful to know when an increasing value (x, increasing from x0 < a) can be detected as entering an interval [a,b], accounting for a possibly blurred comparison between x and a. Would you consider this as very specific ? :-) )


[*] https://github.com/yade/trunk/commit/2172ceb5af8704bf5073f82acfdd8686c89d3c99 [**] https://github.com/yade/trunk/commit/6e5e0a8d1e8008855109bd28bd7098129026f2d2

------
Chargé de Recherche / Research Associate
Irstea, RECOVER
3275 route de Cezanne – CS 40061 13182 Aix-en-Provence Cedex 5 FRANCE
+33 (0)4 42 66 99 21

On 15/11/2018 16:21, Bruno Chareyre wrote:
Hi Jérôme,
I don't know, but I guess they were introduced independently by different authors. I actually don't know why we would need to define tolerance at all, unless in very specific cases.

For instance I judge that a line like this (ViscoelasticPM.cpp) is not only useless but actually wrong:
if (std::abs(cn1) <= Mathr::ZERO_TOLERANCE ) cn1=0;

If it's small let it be small. No need to make it zero. And since cn1 is not dimensionless it implies that currently the accuracy depends on a specific choice of units...

Bruno




Bruno

On 11/15/18 3:54 PM, Jerome Duriez wrote:
Hello,

Out of curiosity, why do we have both Mathr::ZERO_TOLERANCE and Mathr::EPSILON in the code [*] ?

I would understand they're both intended to give an expected magnitude of rounding errors. (Note that ZERO_TOLERANCE is hardcoded as 1e-20, while EPSILON is ~ 2e-16 here)

Both are used throughout the code (EPSILON more often ?)


Thanks,

Jérôme



[*] https://github.com/yade/trunk/blob/3269232e4982c1aa527581a200a0224555b09a1e/lib/base/Math.cpp

------
Chargé de Recherche / Research Associate
Irstea, RECOVER
3275 route de Cezanne – CS 40061 13182 Aix-en-Provence Cedex 5 FRANCE
+33 (0)4 42 66 99 21


_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp



_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp



Follow ups

References