def add_to_point(other)
      check_group! other

      # Assertions:
      # raise "point given (#{point.inspect}) does not belong to #{group.name}" if !group.include?(point)
      # raise "point (#{inspect}) does not belong to #{group.name}" if !group.include?(self)

      # Rules 1 and 2
      return other if infinity?
      return self if other.infinity?

      # Rule 3
      return group.infinity if x == other.x && y == field.mod(-other.y)

      # Rule 4
      if x != other.x
        gamma = field.mod((other.y - y) * field.inverse(other.x - x))
        sum_x = field.mod(gamma * gamma - x - other.x)
        sum_y = field.mod(gamma * (x - sum_x) - y)
        return self.class.new(group, sum_x, sum_y)
      end

      # Rule 5
      return double if self == other

      raise "Failed to add #{inspect} to #{other.inspect}: No addition rules matched."
    end
def add_to_point(other)
      check_group! other

      # Assertions:
      # raise "point given (#{point.inspect}) does not belong to #{group.name}" if !group.include?(point)
      # raise "point (#{inspect}) does not belong to #{group.name}" if !group.include?(self)

      # Rules 1 and 2
      return other if infinity?
      return self if other.infinity?

      # Rule 3
      return group.infinity if x == other.x && y == field.mod(-other.y)

      # Rule 4
      if x != other.x
        gamma = field.mod((other.y - y) * field.inverse(other.x - x))
        sum_x = field.mod(gamma * gamma - x - other.x)
        sum_y = field.mod(gamma * (x - sum_x) - y)
        return self.class.new(group, sum_x, sum_y)
      end

      # Rule 5
      return double if self == other

      raise "Failed to add #{inspect} to #{other.inspect}: No addition rules matched."
    end
Adds this point to another point on the same curve using the standard
 rules for point addition defined in section 2.2.1 of
 [SEC1](http://www.secg.org/collateral/sec1_final.pdf).

 @param other (Point)
 @return The sum of the two points.