本文整理汇总了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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
示例7: Ending
public Ending(Number number, Person person, Tense tense, Voice voice)
{
_number = number;
_person = person;
_tense = tense;
_voice = voice;
}
示例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();
}
示例9: ECKeyPair
internal ECKeyPair (Number d, ECPoint Q, ECDomainParameters domain, ECDomainNames domainName)
{
_d = d;
_Q = Q;
_domain = domain;
_domainName = domainName;
}
示例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;
}
示例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);
}
示例12: PersonalPronoun
private PersonalPronoun(Case personalPronounCase, Number number, Person person, string name)
{
_case = personalPronounCase;
_number = number;
_person = person;
_name = name;
}
示例13: NumberWrapper
public NumberWrapper(Number value)
{
if (value != null)
{
Value = value.Value;
}
}
示例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();
}
}
示例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;
}