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


C# System.Number类代码示例

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


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

示例1: NumberButton_Click

        //所有数字按钮(含小数点)
        private void NumberButton_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;
            if (IsEqualPress)
            {
                FirstNumber.NumString.Clear();
                FirstNumber.NumString.Append("0");
                FirstNumber.Num = 0;
                IsEqualPress = false;
            }

            if (IsFirstNum)
            {
                FirstNumber = JudgeInput(FirstNumber, button);
                ShowResultTextBlock.Text = FirstNumber.NumString.ToString();
                if (ShowResultTextBlock.Text.Length > 8)
                    ShowResultTextBlock.FontSize = 90 * 8 / ShowResultTextBlock.Text.Length;
                else
                    ShowResultTextBlock.FontSize = 90;
            }
            else
            {
                SecondNumber = JudgeInput(SecondNumber, button);
                ShowResultTextBlock.Text = SecondNumber.NumString.ToString();
                if (ShowResultTextBlock.Text.Length > 8)
                    ShowResultTextBlock.FontSize = 90 * 8 / ShowResultTextBlock.Text.Length;
                else
                    ShowResultTextBlock.FontSize = 90;
            }

        }
开发者ID:virtualcca,项目名称:My_Note,代码行数:32,代码来源:Calculator.xaml-Myluobin-Laptop.cs

示例2: DeclareVariable

        /// <summary>
        /// Declares a variable if there is a declaration and deletes unnessesary stuff
        /// </summary>
        /// <param name="listE"> stream of tokens </param>
        /// <returns> true if we need to launch the function again </returns>
        public static bool DeclareVariable(List<Element> listE)
        {
            if (listE.Count > 2) // it can be a declaration only if the list has more than 2 elements
            {
                if (listE[0].Type == C.Number && listE[1].Type == C.Control) // if it is a number
                {
                    string name = listE[0].GetNumber().Name;
                    if (name != "" && listE[1].ToString() == "=") // if it is a variable
                    {
                        listE.RemoveRange(0, 2);
                        Number num = new Number(Parse(listE).Value.ToString());
                        num.Name = name;
                        Variable.Add(num);

                        return false;
                    }
                }
            }

            int index = listE.FindIndex(delegate(Element e)
                                        { if (e.ToString() == "=") return true; return false; });
            if (index != -1) { listE.RemoveRange(0, index + 1); return true; }

            return false;
        }
开发者ID:jakl,项目名称:hashite,代码行数:30,代码来源:Parser.cs

示例3: AbsoluteNumber

        /// <summary>
        /// Creates a new instance of the AbsoluteNumber class
        /// </summary>
        /// <param name="nbr">The number that should be inside the absolute number</param>
        /// <exception cref="ArgumentNullException">Thrown if the number is null</exception>
        public AbsoluteNumber(Number nbr)
        {
            if(nbr == null)
                throw new ArgumentNullException(nameof(nbr),"The number can't be null");

            InnerValue = nbr;
        }
开发者ID:JohannaMoose,项目名称:Lynx,代码行数:12,代码来源:AbsoluteNumber.cs

示例4: HexNumberToInt64

		private static bool HexNumberToInt64(ref Number.NumberBuffer number, ref long value)
		{
			ulong num = 0uL;
			bool result = Number.HexNumberToUInt64(ref number, ref num);
			value = (long)num;
			return result;
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:7,代码来源:Number.cs

示例5: Subtract

		public override Number Subtract (Number x, Number y)
		{
			if (x.data.Length < 6 || y.data.Length < 6)
				return ToElement (base.Subtract (x, y));

			int cmp = x.CompareTo (y);
			if (cmp == 0)
				return PADDED_ZERO;
			uint[] pz = new uint[6], px = x.data, py = y.data;
			if (cmp > 0) {
				uint tmp, carry;
				tmp = py[0]; carry = ((pz[0] = px[0] - tmp) > ~tmp ? 1U : 0U);
				tmp = py[1] + carry; carry = (tmp < carry | (pz[1] = px[1] - tmp) > ~tmp ? 1U : 0U);
				tmp = py[2] + carry; carry = (tmp < carry | (pz[2] = px[2] - tmp) > ~tmp ? 1U : 0U);
				tmp = py[3] + carry; carry = (tmp < carry | (pz[3] = px[3] - tmp) > ~tmp ? 1U : 0U);
				tmp = py[4] + carry; carry = (tmp < carry | (pz[4] = px[4] - tmp) > ~tmp ? 1U : 0U);
				pz[5] = px[5] - py[5] - carry;
			} else {
				long tmp;
				int carry = 0;
				pz[0] = (uint)(tmp = ((long)px[0]) + ((long)P1) - ((long)py[0]) - carry); carry = (tmp < 0 ? 1 : tmp > 0xFFFFFFFF ? -1 : 0);
				pz[1] = (uint)(tmp = ((long)px[1]) + ((long)P2) - ((long)py[1]) - carry); carry = (tmp < 0 ? 1 : tmp > 0xFFFFFFFF ? -1 : 0);
				pz[2] = (uint)(tmp = ((long)px[2]) + ((long)P3) - ((long)py[2]) - carry); carry = (tmp < 0 ? 1 : tmp > 0xFFFFFFFF ? -1 : 0);
				pz[3] = (uint)(tmp = ((long)px[3]) + ((long)P4) - ((long)py[3]) - carry); carry = (tmp < 0 ? 1 : tmp > 0xFFFFFFFF ? -1 : 0);
				pz[4] = (uint)(tmp = ((long)px[4]) + ((long)P5) - ((long)py[4]) - carry); carry = (tmp < 0 ? 1 : tmp > 0xFFFFFFFF ? -1 : 0);
				pz[5] = (uint)(tmp = ((long)px[5]) + ((long)P6) - ((long)py[5]) - carry);
			}
			return new Number (pz);
		}
开发者ID:kazuki,项目名称:opencrypto.net,代码行数:29,代码来源:SECP192r1.cs

示例6: 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:nlerikheemskerk,项目名称:cassette,代码行数:7,代码来源:HslColor.cs

示例7: Ending

 public Ending(Number number, Person person, Tense tense, Voice voice)
 {
     _number = number;
       _person = person;
       _tense = tense;
       _voice = voice;
 }
开发者ID:skeletank,项目名称:Language-Learning,代码行数:7,代码来源:Ending.cs

示例8: Main

        static void Main(string[] args)
        {
            //constant
            var one = new Number<Bit>();
            one.Construct();

            //a few additions
            var two = one.Add(one);
            var three = one.Add(two);
            var six = three.Add(three);
            var ten = one.Add(three.Add(six));

            //proof that any regular object can be used, not just one which represents a bit
            var anotherOne = new Number<Number<Bit>>();
            anotherOne.Construct();
            var four = anotherOne.Add(anotherOne.Add(anotherOne.Add(anotherOne)));

            //display results
            Console.WriteLine("one: {0}: '{1}'", one.Evaluate(), one);
            Console.WriteLine("two: {0}: '{1}'", two.Evaluate(), two);
            Console.WriteLine("three: {0}: '{1}'", three.Evaluate(), three);
            Console.WriteLine("four: {0}: '{1}'", four.Evaluate(), four);
            Console.WriteLine("six: {0}: '{1}'", six.Evaluate(), six);
            Console.WriteLine("ten: {0}: '{1}'", ten.Evaluate(), ten);

            Console.ReadKey();
        }
开发者ID:gulbanana,项目名称:regulartypes,代码行数:27,代码来源:Program.cs

示例9: ECKeyPair

		internal ECKeyPair (Number d, ECPoint Q, ECDomainParameters domain, ECDomainNames domainName)
		{
			_d = d;
			_Q = Q;
			_domain = domain;
			_domainName = domainName;
		}
开发者ID:kazuki,项目名称:opencrypto.net,代码行数:7,代码来源:ECKeyPair.cs

示例10: Barrett

		public Barrett (Number mod) : base (mod)
		{
			int len = mod.length << 1;
			constant = new Number (len + 1);
			constant.data[len] = 1;
			constant = constant / mod;
		}
开发者ID:kazuki,项目名称:opencrypto.net,代码行数:7,代码来源:Barrett.cs

示例11: Add

		public override Number Add (Number x, Number y)
		{
			if (x.data.Length < 6 || y.data.Length < 6) return ToElement (base.Add (x, y));

			ulong sum;
			uint[] pz = new uint[7], px = x.data, py = y.data;
			uint tmp, carry;

			pz[0] = (uint)(sum = ((ulong)px[0]) + ((ulong)py[0])); sum >>= 32;
			pz[1] = (uint)(sum += ((ulong)px[1]) + ((ulong)py[1])); sum >>= 32;
			pz[2] = (uint)(sum += ((ulong)px[2]) + ((ulong)py[2])); sum >>= 32;
			pz[3] = (uint)(sum += ((ulong)px[3]) + ((ulong)py[3])); sum >>= 32;
			pz[4] = (uint)(sum += ((ulong)px[4]) + ((ulong)py[4])); sum >>= 32;
			pz[5] = (uint)(sum += ((ulong)px[5]) + ((ulong)py[5])); sum >>= 32;
			pz[6] = (uint)sum;

			if (pz[6] != 0 || CompareTo (pz[0], pz[1], pz[2], pz[3], pz[4], pz[5]) <= 0) {
				carry = ((pz[0] -= P1) > ~P1 ? 1U : 0U);
				tmp = P2 + carry; carry = (tmp < carry | (pz[1] -= tmp) > ~tmp ? 1U : 0U);
				tmp = P3 + carry; carry = (tmp < carry | (pz[2] -= tmp) > ~tmp ? 1U : 0U);
				tmp = P4 + carry; carry = (tmp < carry | (pz[3] -= tmp) > ~tmp ? 1U : 0U);
				tmp = P5 + carry; carry = (tmp < carry | (pz[4] -= tmp) > ~tmp ? 1U : 0U);
				pz[5] -= P6 + carry;
			}
			pz[6] = 0;
			return new Number (pz);
		}
开发者ID:kazuki,项目名称:opencrypto.net,代码行数:27,代码来源:SECP192r1.cs

示例12: PersonalPronoun

 private PersonalPronoun(Case personalPronounCase, Number number, Person person, string name)
 {
     _case = personalPronounCase;
       _number = number;
       _person = person;
       _name = name;
 }
开发者ID:skeletank,项目名称:Language-Learning,代码行数:7,代码来源:PersonalPronoun.cs

示例13: NumberWrapper

 public NumberWrapper(Number value)
 {
     if (value != null)
     {
         Value = value.Value;
     }
 }
开发者ID:javachengwc,项目名称:many-ql,代码行数:7,代码来源:NumberWrapper.cs

示例14: GetInfix

 private string GetInfix(Person person, Number number)
 {
     switch (_infixType)
       {
     case InfixType.B:
       if (person == Person.First && number == Number.Singular)
       {
     return "bo";
       }
       if (person == Person.Second && number == Number.Singular)
       {
     return "be";
       }
       if (person == Person.Third && number == Number.Plural)
       {
     return "bu";
       }
       return "bi";
     case InfixType.A:
       if (person == Person.First && number == Number.Singular)
       {
     return "a";
       }
       return "e";
     default:
       throw new NotImplementedException();
       }
 }
开发者ID:skewwhiffy,项目名称:LatinTester,代码行数:28,代码来源:Future.cs

示例15: HexNumberToInt32

		private static bool HexNumberToInt32(ref Number.NumberBuffer number, ref int value)
		{
			uint num = 0u;
			bool result = Number.HexNumberToUInt32(ref number, ref num);
			value = (int)num;
			return result;
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:7,代码来源:Number.cs


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