Is this routine for determining the epsilon of a Double 100% valid?
a != double.NegativeInfinity &amp;&amp; a != double.PositiveInfinity


This could be simplified to just double.IsInfinity(a). Though as far as I know, it is correct. I was worried that there may be more values representing infinity, like there are for NaN, but that doesn't seem to be the case.



Otherwise, your method seems to work to me in all edge cases, including +/-0, double.MaxValue and double.Epsilon (though you should write unit tests for these just in case). In the case of +/-0 and TowardsZero, D will become NaN, so your method returns null, which I think is correct behavior.