当前位置: 首页>>代码示例>>C#>>正文


C# Number类代码示例

本文整理汇总了C#中Number的典型用法代码示例。如果您正苦于以下问题:C# Number类的具体用法?C# Number怎么用?C# Number使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Number类属于命名空间,在下文中一共展示了Number类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            while (true)
            {
                string inputStringA = Console.ReadLine();
                Number inputNum = new Number(inputStringA, false, 0, 0);
          //      string inputStringB = Console.ReadLine();
            //    Number testNum = new Number(inputStringB, false, 0, 0);
                int accuracy = Convert.ToInt32(Console.ReadLine());

            //    Calculation Cal = new Calculation();
              //  Number result = Cal.Multiply(inputNum, testNum, accuracy);

                RangeAssist rangeAssist = new RangeAssist(inputNum, accuracy);

                Taylor taylor = new Taylor(rangeAssist.numConverted, accuracy);
                Number resultTaylor = rangeAssist.NumRecover(taylor.TaylorCalculate());
                resultTaylor.Display();

                Romberg romberg = new Romberg(rangeAssist.numConverted, accuracy);
                Number resultRomberg = rangeAssist.NumRecover(romberg.RombergCalculate());
                resultTaylor.Display();

                Newton newton = new Newton(rangeAssist.numConverted, accuracy);
                Number resultNewton = rangeAssist.NumRecover(newton.NewtonCalculate());
                resultNewton.Display();

               /* Euler Eul = new Euler(inputNum, accuracy);
                Number resultEul = Eul.EulerCalcutation();
                resultEul.Display();*/
            }
        }
开发者ID:lohasbai,项目名称:Arctanx,代码行数:32,代码来源:Program.cs

示例2: MeanAndStandardDeviation

 public MeanAndStandardDeviation(Number mean, Number standardDeviation)
 {
   base.\u002Ector();
   MeanAndStandardDeviation standardDeviation1 = this;
   this.mean = mean;
   this.standardDeviation = standardDeviation;
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:7,代码来源:MeanAndStandardDeviation.cs

示例3: NounWorks

 protected void NounWorks(Noun noun, Dictionary<Case, string> expected, Number number, string nounName)
 {
     foreach (KeyValuePair<Case, string> kvp in expected)
       {
     Assert.AreEqual(kvp.Value, noun.Get(kvp.Key, number), "{0} {1} for {2} doesn't work", kvp.Key, number, nounName);
       }
 }
开发者ID:skewwhiffy,项目名称:LatinTester,代码行数:7,代码来源:NounDeclensionTestBase.cs

示例4: Play

 /// <summary>
 /// Simulates a throw of the ball on the roulette.
 /// </summary>
 /// <returns>The number where the ball landed.</returns>
 public Number Play()
 {
     int v = _Rand.Next(0, 36);
     Number n= new Number(v);
     History.Add(n);
     return n;
 }
开发者ID:SRKX,项目名称:casino-martingale,代码行数:11,代码来源:Roulette.cs

示例5: Source

        /*
         * Construct attatched to a number
         */
        public Source(Number number,        string name,
                  string referring_url, string not_referrer_url,
                  string landing_url,   string not_landing_url,
                  int    position,      bool   online)
        {
            this.token            = number.token;
              this.name             = name;
              this.referring_url    = referring_url;
              this.not_referrer_url = not_referrer_url;
              this.landing_url      = landing_url;
              this.not_landing_url  = not_landing_url;
              this.online           = online;
              this.position         = position;

              if (number.id == ""){
            this.error = "Number has no id";
            return;
              }

              string url = CTM.Config.Endpoint() + "/accounts/" + token.account_id + "/numbers/" + number.id + "/tracking_sources.json";

              CTM.Response res = new CTM.Request(url, token).post(this.params_hash());

              if (res.error != null){
            this.error = res.error;
              }else{
            this.update_from(res.data.source);
              }
        }
开发者ID:calltracking,项目名称:ctm-csharp,代码行数:32,代码来源:source.cs

示例6: TestBasicComparison

        public void TestBasicComparison()
        {
            Number n1 = new Number(6, new List<char>() { 'i', 'g' }); //12
            Number n2 = new Number(6, new List<char>() { 'i', 's' }); //13
            Assert.AreEqual(Order.LESSER, numberSystem.Compare(n1, n2));

             n1 = new Number(6, new List<char>() { 'i', 's' }); //12
             n2 = new Number(6, new List<char>() { 'i', 'g' }); //13
            Assert.AreEqual(Order.GREATER, numberSystem.Compare(n1, n2));

            n1 = new Number(6, new List<char>() { 'i', 'g' }); //12
            n2 = new Number(6, new List<char>() { 'i', 'g' }); //13
            Assert.AreEqual(Order.EQUAL, numberSystem.Compare(n1, n2));

            n1 = new Number(6, new List<char>() { 'i', 'g', 's' }); //123
            n2 = new Number(6, new List<char>() { 'g', 'g' }); //22
            Assert.AreEqual(Order.GREATER, numberSystem.Compare(n1, n2));

            n1 = new Number(6, new List<char>() { 'i', 'o' }); //14 => 10 in base10
            n2 = new Number(10, new List<char>() { 'i', 'b' }); //10 in decimal 10
            Assert.AreEqual(Order.EQUAL, numberSystem.Compare(n1, n2));

            n1 = new Number(6, new List<char>() { 'g', 'i' }); //20 => 12 in base10
            n2 = new Number(10, new List<char>() { 'i', 'b' }); //10 in decimal 10
            Assert.AreEqual(Order.GREATER, numberSystem.Compare(n1, n2));

            n1 = new Number(2, new List<char>() { 'i', 'b', 'b', 'b' }); //1000 in base2 => 8 in base10
            n2 = new Number(10, new List<char>() { 'i', 'b' }); //10 in decimal 10
            Assert.AreEqual(Order.LESSER, numberSystem.Compare(n1, n2));
        }
开发者ID:02ps719,项目名称:DSA,代码行数:30,代码来源:ComparisonTest.cs

示例7: fillValues

        public Number[] fillValues(Number[] source)
        {
            List<double> Bx = new List<double>();
            List<double> By = new List<double>();
            List<double> Bz = new List<double>();
            List<double> x = new List<double>();
            int n;

            for (int i = 0; i < source.Length; i++)
            {
                if (source[i] != null)
                {
                    x.Add(i);
                    Bx.Add(source[i].x);
                    By.Add(source[i].y);
                    Bz.Add(source[i].z);
                }
            }

            n = x.Count();

            SplineTuple[] splinesX = BuildSpline(x.ToArray(), Bx.ToArray(), n);
            SplineTuple[] splinesY = BuildSpline(x.ToArray(), By.ToArray(), n);
            SplineTuple[] splinesZ = BuildSpline(x.ToArray(), Bz.ToArray(), n);

            for (int i = 0; i < source.Length; i++)
            {
                if (source[i] == null)
                {
                    source[i] = new Number(Interpolate(i, splinesX), Interpolate(i, splinesY), Interpolate(i, splinesZ));
                }
            }

            return source;
        }
开发者ID:programmerr47,项目名称:diplomaV2_0,代码行数:35,代码来源:CubicSpline.cs

示例8: Clock

 /// <summary>
 /// constructor for a Clock object
 /// </summary>
 public Clock()
 {
     minutes = new Number(60);
     seconds = new Number(60);
     thousandths = new ThreeDigitNumber(1000);
     UpdateDisplay();
 }
开发者ID:jhpaterson,项目名称:LahtiOOP,代码行数:10,代码来源:Clock.cs

示例9: When_CompareNumbers_Then_Success

        public void When_CompareNumbers_Then_Success()
        {
            var mainNumber = new Number(6, 8, 0, 1);
            var numberToCompare1 = new Number(1, 8, 9, 4);
            var numberToCompare2 = new Number(6, 8, 0, 1);
            var numberToCompare3 = new Number(1, 0, 6, 2);
            var numberComparer = new NumberComparer();

            var attemptResult1 = numberComparer.Compare(mainNumber, numberToCompare1);
            var attemptResult2 = numberComparer.Compare(mainNumber, numberToCompare2);
            var attemptResult3 = numberComparer.Compare(mainNumber, numberToCompare3);

            Assert.AreEqual(numberToCompare1, attemptResult1.Number);
            Assert.AreEqual(1, attemptResult1.Goods);
            Assert.AreEqual(1, attemptResult1.Regulars);
            Assert.AreEqual(2, attemptResult1.Bads);

            Assert.AreEqual(numberToCompare2, attemptResult2.Number);
            Assert.AreEqual(4, attemptResult2.Goods);
            Assert.AreEqual(0, attemptResult2.Regulars);
            Assert.AreEqual(0, attemptResult2.Bads);

            Assert.AreEqual(numberToCompare3, attemptResult3.Number);
            Assert.AreEqual(0, attemptResult3.Goods);
            Assert.AreEqual(3, attemptResult3.Regulars);
            Assert.AreEqual(1, attemptResult3.Bads);
        }
开发者ID:ThinkUpStudios,项目名称:GuessMyNumber,代码行数:27,代码来源:NumberComparerTests.cs

示例10: DerivativeTest3

        public void DerivativeTest3()
        {
            // x ^ 3
            Variable x = new Variable("x");
            Number num1 = new Number(3);

            IExpression exp = new Pow(x, num1);
            IExpression deriv = exp.Differentiate();

            Assert.AreEqual("1 * (3 * (x ^ (3 - 1)))", deriv.ToString());

            num1.Value = 4;
            Assert.AreEqual("x ^ 4", exp.ToString());
            Assert.AreEqual("1 * (3 * (x ^ (3 - 1)))", deriv.ToString());

            // 2 ^ (3x)
            Number num2 = new Number(2);
            num1 = new Number(3);
            Mul mul = new Mul(num1, x.Clone());

            exp = new Pow(num2, mul);
            deriv = exp.Differentiate();

            Assert.AreEqual("(ln(2) * (2 ^ (3 * x))) * (3 * 1)", deriv.ToString());

            num1.Value = 4;
            Assert.AreEqual("2 ^ (4 * x)", exp.ToString());
            Assert.AreEqual("(ln(2) * (2 ^ (3 * x))) * (3 * 1)", deriv.ToString());
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:29,代码来源:ExponentiationTest.cs

示例11: SLColor

 public SLColor( double Red, double Green, double Blue )
     : this()
 {
     red = new Number( Red );
     green = new Number( Green );
     blue = new Number( Blue );
 }
开发者ID:LukaHorvat,项目名称:Kento,代码行数:7,代码来源:SLColor.cs

示例12: AdjectiveForm

 internal AdjectiveForm(Stem stem, Gender gender, Case @case, Number number, string suffix)
     : base(stem, suffix)
 {
     Gender = gender;
     Case = @case;
     Number = number;
 }
开发者ID:IxMilia,项目名称:Classics,代码行数:7,代码来源:AdjectiveForm.cs

示例13: Main

    public static int Main(string[] args)
    {
        if (args.Length < 5) {
            System.Console.WriteLine("Usage: <number> <base> <charset> <newBase> <newCharset>");
            return 1;
        }

        if (args[1] == "-") {
            args[1] = "10";
        }

        if (args[2] == "-") {
            args[2] = Number.DefaultCharset();
        }

        if (args[4] == "-") {
            args[4] = Number.DefaultCharset();
        }

        try {
            Number number = new Number(args[0], System.Convert.ToInt32(args[1]), args[2]);
            System.Console.WriteLine(number.ToBase(System.Convert.ToInt32(args[3]), args[4]));
        }
        catch (System.Exception e) {
            System.Console.WriteLine("Error: " + e.Message);

            return 2;
        }

        return 0;
    }
开发者ID:rlishtaba,项目名称:random,代码行数:31,代码来源:baseconverter.cs

示例14: MainWindow

 public MainWindow()
 {
   InitializeComponent();
   if (Directory.Exists(systemDir))
     Directory.Delete(systemDir, true); // remove systemDir from prior runs and all its databases.
   try
   {
     session = new SessionBase[4];
     thread = new Thread[4];
     session[0] = new SessionNoServer(systemDir, int.Parse(session1LockTimeout.Text));
     session[1] = new SessionNoServer(systemDir, int.Parse(session2LockTimeout.Text));
     session[2] = new SessionNoServer(systemDir, int.Parse(session3LockTimeout.Text));
     session[3] = new SessionNoServer(systemDir, int.Parse(session4LockTimeout.Text));
     session[0].BeginUpdate();
     Placement place = new Placement(10);
     Number number = new Number();
     session[0].Persist(place, number);
     number = new Number(2);
     place = new Placement(11);
     session[0].Persist(place, number);
     number = new Number(3);
     place = new Placement(12);
     session[0].Persist(place, number);
     session[0].Commit();
   }
   catch (Exception ex)
   {
     session1messages.Content = ex.Message;
   }
 }
开发者ID:VelocityDB,项目名称:VelocityDB,代码行数:30,代码来源:DatabaseLocking.xaml.cs

示例15: HslColor

 public HslColor(Number hue, Number saturation, Number lightness, Number alpha)
 {
   Hue = (hue.ToNumber()/360d)%1d;
   Saturation = saturation.Normalize(100d)/100d;
   Lightness = lightness.Normalize(100d)/100d;
   Alpha = alpha.Normalize();
 }
开发者ID:jamesfoster,项目名称:dotless.js,代码行数:7,代码来源:HslColor.cs


注:本文中的Number类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。