Javier Ángel Velázquez Muriel wrote: > I am going to suggest something that is not very "correct", but that it > is already "de facto" in IMP. I would suggest a default epsilon value > for the cases where the use of "almost_equal" function cannot be > avoided. That is dangerous, I know, but I think it is even more > dangerous to have the code full of different epsilons if they don't need > to be different. > > I'm saying this because IMP::em already has a EPS value of 1e-6 that is > thoroughly used, and probably makes sense to define one EPS in other > modules.
I disagree. You can't have "one true epsilon" because it depends on what you are comparing. If you are comparing two numbers which are themselves around 1e-6, that epsilon value is useless, for example. And in many cases, it makes sense to use a percentage.
> My need is to compute the correlation between two em::Images, that in > fact is going to be the correlation between their algebra::MultiArrays > containing the data, and I need to check for values of the standard > deviation (which is a double) near zero. I don't see how to avoid the > use of almost_equal() here, and again, a default epsilon for > IMP::algebra sounds reasonable to me.
Well, of course you will need an "almost_equal" function, because you can't compare two floating point numbers exactly in most circumstances. But a "default epsilon" makes no sense.
Ben