Esempio n. 1
0
 /// <summary>
 /// Obtém a diferença entre o número complexo actual e outro número complexo.
 /// </summary>
 /// <param name="right">O outro número complexo.</param>
 /// <param name="ring">O anel responsável pelas operações.</param>
 /// <returns>O resultado da diferença.</returns>
 /// <exception cref="ArgumentNullException">Se algum dos argumentos for nulo.</exception>
 public ComplexNumber <ObjectType> Subtract(ComplexNumber <ObjectType> right, IRing <ObjectType> ring)
 {
     if (ring == null)
     {
         throw new ArgumentNullException("ring");
     }
     else if (right == null)
     {
         throw new ArgumentNullException("right");
     }
     else
     {
         var result = new ComplexNumber <ObjectType>();
         result.realPart      = ring.Add(this.realPart, ring.AdditiveInverse(right.realPart));
         result.imaginaryPart = ring.Add(this.imaginaryPart, ring.AdditiveInverse(right.imaginaryPart));
         return(result);
     }
 }