本文整理汇总了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();*/
}
}
示例2: MeanAndStandardDeviation
public MeanAndStandardDeviation(Number mean, Number standardDeviation)
{
base.\u002Ector();
MeanAndStandardDeviation standardDeviation1 = this;
this.mean = mean;
this.standardDeviation = standardDeviation;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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));
}
示例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;
}
示例8: Clock
/// <summary>
/// constructor for a Clock object
/// </summary>
public Clock()
{
minutes = new Number(60);
seconds = new Number(60);
thousandths = new ThreeDigitNumber(1000);
UpdateDisplay();
}
示例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);
}
示例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());
}
示例11: SLColor
public SLColor( double Red, double Green, double Blue )
: this()
{
red = new Number( Red );
green = new Number( Green );
blue = new Number( Blue );
}
示例12: AdjectiveForm
internal AdjectiveForm(Stem stem, Gender gender, Case @case, Number number, string suffix)
: base(stem, suffix)
{
Gender = gender;
Case = @case;
Number = number;
}
示例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;
}
示例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;
}
}
示例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();
}