Beispiel #1
0
        protected ComparerResult CompareObjects(object x, object y, NumericTolerance tolerance)
        {
            var builder = new IntervalBuilder(x);

            builder.Build();
            if (builder.IsValid())
            {
                return(CompareDecimals
                       (
                           builder.GetInterval()
                           , Convert.ToDecimal(y, NumberFormatInfo.InvariantInfo)
                       ));
            }

            builder = new IntervalBuilder(y);
            builder.Build();
            if (builder.IsValid())
            {
                return(CompareDecimals
                       (
                           builder.GetInterval()
                           , Convert.ToDecimal(x, NumberFormatInfo.InvariantInfo)
                       ));
            }

            var rxDecimal = Convert.ToDecimal(x, NumberFormatInfo.InvariantInfo);
            var ryDecimal = Convert.ToDecimal(y, NumberFormatInfo.InvariantInfo);

            return(CompareDecimals(rxDecimal, ryDecimal, tolerance));
        }
Beispiel #2
0
        protected ComparerResult CompareObjects(object x, object y, NumericTolerance tolerance)
        {
            var builder = new IntervalBuilder(x);

            builder.Build();
            if (builder.IsValid())
            {
                return(CompareDecimals
                       (
                           builder.GetInterval()
                           , converter.Convert(y)
                       ));
            }

            builder = new IntervalBuilder(y);
            builder.Build();
            if (builder.IsValid())
            {
                return(CompareDecimals
                       (
                           builder.GetInterval()
                           , converter.Convert(x)
                       ));
            }

            var rxDecimal = converter.Convert(x);
            var ryDecimal = converter.Convert(y);

            return(CompareDecimals(rxDecimal, ryDecimal, tolerance));
        }
Beispiel #3
0
        protected override ComparerResult CompareObjects(object x, object y)
        {
            var builder = new IntervalBuilder(x);

            builder.Build();
            if (builder.IsValid())
            {
                return(CompareDecimals
                       (
                           builder.GetInterval()
                           , Convert.ToDecimal(y, NumberFormatInfo.InvariantInfo)
                       ));
            }

            builder = new IntervalBuilder(y);
            builder.Build();
            if (builder.IsValid())
            {
                return(CompareDecimals
                       (
                           builder.GetInterval()
                           , Convert.ToDecimal(x, NumberFormatInfo.InvariantInfo)
                       ));
            }

            return(CompareObjects(x, y, new NumericAbsoluteTolerance(0)));
        }
Beispiel #4
0
        protected override ComparerResult CompareObjects(object x, object y)
        {
            var builder = new IntervalBuilder(x);

            builder.Build();
            if (builder.IsValid())
            {
                return(CompareDecimals
                       (
                           builder.GetInterval()
                           , converter.Convert(y)
                       ));
            }

            builder = new IntervalBuilder(y);
            builder.Build();
            if (builder.IsValid())
            {
                return(CompareDecimals
                       (
                           builder.GetInterval()
                           , converter.Convert(x)
                       ));
            }

            return(CompareObjects(x, y, NumericAbsoluteTolerance.None));
        }
Beispiel #5
0
        protected override ComparerResult CompareObjects(object x, object y)
        {
            var builder = new IntervalBuilder(x);
            builder.Build();
            if (builder.IsValid())
                return CompareDecimals
                    (
                        builder.GetInterval()
                        , Convert.ToDecimal(y, NumberFormatInfo.InvariantInfo)
                    );

            builder = new IntervalBuilder(y);
            builder.Build();
            if (builder.IsValid())
                return CompareDecimals
                    (
                        builder.GetInterval()
                        , Convert.ToDecimal(x, NumberFormatInfo.InvariantInfo)
                    );

            return CompareObjects(x, y, new NumericAbsoluteTolerance(0));
        }
Beispiel #6
0
        protected ComparerResult CompareObjects(object x, object y, NumericTolerance tolerance)
        {
            var builder = new IntervalBuilder(x);
            builder.Build();
            if (builder.IsValid())
                return CompareDecimals
                    (
                        builder.GetInterval()
                        , Convert.ToDecimal(y, NumberFormatInfo.InvariantInfo)
                    );

            builder = new IntervalBuilder(y);
            builder.Build();
            if (builder.IsValid())
                return CompareDecimals
                    (
                        builder.GetInterval()
                        , Convert.ToDecimal(x, NumberFormatInfo.InvariantInfo)
                    );

            var rxDecimal = Convert.ToDecimal(x, NumberFormatInfo.InvariantInfo);
            var ryDecimal = Convert.ToDecimal(y, NumberFormatInfo.InvariantInfo);

            return CompareDecimals(rxDecimal, ryDecimal, tolerance);
        }
Beispiel #7
0
        protected override ComparerResult CompareObjects(object x, object y)
        {
            var builder = new IntervalBuilder(x);
            builder.Build();
            if (builder.IsValid())
                return CompareDecimals
                    (
                        builder.GetInterval()
                        , converter.Convert(y)
                    );

            builder = new IntervalBuilder(y);
            builder.Build();
            if (builder.IsValid())
                return CompareDecimals
                    (
                        builder.GetInterval()
                        , converter.Convert(x)
                    );

            return CompareObjects(x, y, NumericAbsoluteTolerance.None);
        }
Beispiel #8
0
        protected ComparerResult CompareObjects(object x, object y, NumericTolerance tolerance)
        {
            var builder = new IntervalBuilder(x);
            builder.Build();
            if (builder.IsValid())
                return CompareDecimals
                    (
                        builder.GetInterval()
                        , converter.Convert(y)
                    );

            builder = new IntervalBuilder(y);
            builder.Build();
            if (builder.IsValid())
                return CompareDecimals
                    (
                        builder.GetInterval()
                        , converter.Convert(x)
                    );

            var rxDecimal = converter.Convert(x);
            var ryDecimal = converter.Convert(y);

            return CompareDecimals(rxDecimal, ryDecimal, tolerance);
        }