本文整理汇总了C#中ComplexNumber.Divide方法的典型用法代码示例。如果您正苦于以下问题:C# ComplexNumber.Divide方法的具体用法?C# ComplexNumber.Divide怎么用?C# ComplexNumber.Divide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ComplexNumber
的用法示例。
在下文中一共展示了ComplexNumber.Divide方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Simple
public void Simple()
{
var complexNumber1 = new ComplexNumber(-8, 4);
var complexNumber2 = new ComplexNumber(3, 1);
var divComplexNumber = complexNumber1.Divide(complexNumber2);
Assert.AreEqual(-2, divComplexNumber.Real);
Assert.AreEqual(2, divComplexNumber.Imaginary);
divComplexNumber = complexNumber1.Divide(4);
Assert.AreEqual(-2, divComplexNumber.Real);
Assert.AreEqual(1, divComplexNumber.Imaginary);
complexNumber1 = new ComplexNumber(2, 6);
complexNumber2 = new ComplexNumber(4, 1);
divComplexNumber = complexNumber1.Divide(complexNumber2);
Assert.AreEqual(14 / (double) 17, divComplexNumber.Real);
Assert.AreEqual(22 / (double) 17, divComplexNumber.Imaginary);
}
示例2: DivideDoubleExample
public void DivideDoubleExample()
{
var complexNumber1 = new ComplexNumber(8, 4);
var div = complexNumber1.Divide(2);
Assert.AreEqual(div.Real, 4);
Assert.AreEqual(div.Imaginary, 2);
}
示例3: DivideComplexNumberExample
public void DivideComplexNumberExample()
{
var complexNumber1 = new ComplexNumber(-8, 4);
var complexNumber2 = new ComplexNumber(3, 1);
var div = complexNumber1.Divide(complexNumber2);
Assert.AreEqual(div.Real, -2);
Assert.AreEqual(div.Imaginary, 2);
}