Comparing approximate values in c# 4.0?
<p>First of all, please excuse any typo, English is not my native language.</p>

<p>Here's my question. I'm creating a class that represents approximate values as such:</p>

<pre><code>public sealed class ApproximateValue
{
    public double MaxValue { get; private set; }
    public double MinValue { get; private set; }
    public double Uncertainty { get; private set; }
    public double Value { get; private set; }

    public ApproximateValue(double value, double uncertainty)
    {
        if (uncertainty &lt; 0) { throw new ArgumentOutOfRangeException("uncertainty", "Value must be postivie or equal to 0."); }

        this.Value = value;
        this.Uncertainty = uncertainty;
        this.MaxValue = this.Value + this.Uncertainty;
        this.MinValue = this.Value - this.Uncertainty;
    }
}
</code></pre>

<p>I want to use this class for uncertain measurments, like x = 8.31246 +/-0.0045 for example and perform calculations on these values.</p>

<p>I want to overload operators in this class. I don't know how to implement the >, >=, &lt;= and &lt; operators... The first thing I thought of is something like this:</p>

<pre><code>    public static bool? operator &gt;(ApproximateValue a, ApproximateValue b)
    {
        if (a == null || b == null) { return null; }

        if (a.MinValue &gt; b.MaxValue) { return true; }
        else if (a.MaxValue &lt; b.MinValue) { return false; }
        else { return null; }
    }
</code></pre>

<p>However, in the last case, I'm not satisfied with this 'null' as the accurate result is not 'null'. It may be 'true' or it may be 'false'.</p>

<p>Is there any object in .Net 4 that would help implementing this feature I am not aware of, or am I doing the correct way? I was also thinking about using an object instead of a boolean that would define in what circumstances the value is superior or not to another one rather than implementing comparison operators but I feel it's a bit too complex for what I'm trying to achieve...</p>
