Does it exist error or bug in "REngine.GetInstance()"?

Mar 24, 2016 at 9:00 AM
Hi, I really would love to use it in my C# programs via RDotNet.

I've added R.net via Manage NuGet Packages in VS2013 (RDotNet runtime Version v4.0.30319).

Within Windows 7 I'm running R-3.1.0 a within my C:\Program Files\R\R-3.1.0\bin folder.

Here's code as below:
        public double StandardDeviation(double[] examples)
        {
            double STD = Double.NaN;

          //====Test 1. Start======
            int Oos1 = 2;
            int SiteCount1 = 5;
            string KeyItem1 = "60";
            string waferPass1;

            if ((Convert.ToDouble(Oos1) / Convert.ToDouble(SiteCount1)) >
                 ((Convert.ToDouble(100) - Convert.ToDouble(KeyItem1))
                    / Convert.ToDouble(100)))
            //return false
            {
                waferPass1 = "N";
            }
            else
            {
                waferPass1 = "Y";
            }
            //====Test 1. End======

            //  Initial/Using R.Net Component
            REngine regine = REngine.GetInstance();

            //====Test 2. Start======
            int Oos2 = 2;
            int SiteCount2 = 5;
            string KeyItem2 = "60";
            string waferPass2;

            if ((Convert.ToDouble(Oos2) / Convert.ToDouble(SiteCount2)) >
                 ((Convert.ToDouble(100) - Convert.ToDouble(KeyItem2))
                    / Convert.ToDouble(100)))
            //return true
            {
                waferPass2 = "N";
            }
            else
            {
                waferPass2 = "Y";
            }
           //====Test 2. End======
            ......................
        }
The REngine.GetInstance() Made the same if-else statement (Test 1 & Test 2) get different result.

Test 1 if statement is correct (return false). Test 2 statement return wrong result (return true).

What's happened in 'REngine regine = REngine.GetInstance()' ?

After run 'REngine.GetInstance()' The Test 2 if statement got wrong result.

I have no idea about this. Is this bug in RDotNet?

Thanks for your help.