> ... The inner parenthesis comparison, D~=0, is > comparing floating point numbers in D to 0. If there is a very, very > small value of D, say 1e-20, which really should be zero, I don't want > that value returned. In your case, since I didn't specify how D was > created, shouldn't you have included that?
Well, if that is the issue then yes. I presumed that ~=0 was intended to be that by design/intent.
If you're indeed trying to exclude for some tolerance then indeed you do need to make the comparison based on that.
Whether that's a constant or a percentage of the magnitude or just what it is then is dependent upon the objectives.