def double(self):
        """
        Doubles this point.

        Returns:
            AffinePoint: The point corresponding to `2 * self`.
        """
        X1, Y1, a, P = self.X, self.Y, self.a, self.P

        if self.infinity:
            return self

        S = ((3 * X1 ** 2 + a) * self.inverse(2 * Y1)) % P
        X2 = (S ** 2 - (2 * X1)) % P
        Y2 = (S * (X1 - X2) - Y1) % P
        return AffinePoint(X2, Y2)
Doubles this point.

        Returns:
            AffinePoint: The point corresponding to `2 * self`.