public override ECPoint Subtract(ECPoint b) { if (b.IsInfinity) { return(this); } return(Add(b.Negate())); }
public override ECPoint Subtract( ECPoint b) { if (b.IsInfinity) return this; // Add -b return Add(b.Negate()); }
// D.3.2 pg 102 (see Note:) public override ECPoint Subtract(ECPoint b) { return b.IsInfinity ? this : Add(b.Negate()); }
/** * Tests <code>ECPoint.add()</code> and <code>ECPoint.subtract()</code> * for the given point and the given point at infinity. * * @param p * The point on which the tests are performed. * @param infinity * The point at infinity on the same curve as <code>p</code>. */ private void ImplTestAddSubtract(ECPoint p, ECPoint infinity) { AssertPointsEqual("Twice and Add inconsistent", p.Twice(), p.Add(p)); AssertPointsEqual("Twice p - p is not p", p, p.Twice().Subtract(p)); AssertPointsEqual("TwicePlus(p, -p) is not p", p, p.TwicePlus(p.Negate())); AssertPointsEqual("p - p is not infinity", infinity, p.Subtract(p)); AssertPointsEqual("p plus infinity is not p", p, p.Add(infinity)); AssertPointsEqual("infinity plus p is not p", p, infinity.Add(p)); AssertPointsEqual("infinity plus infinity is not infinity ", infinity, infinity.Add(infinity)); AssertPointsEqual("Twice infinity is not infinity ", infinity, infinity.Twice()); }
// D.3.2 pg 102 (see Note:) public override ECPoint Subtract(ECPoint b) { return(b.IsInfinity ? this : Add(b.Negate())); }