code: def _compute_prob_outside_square(n, h):  # pragma: no cover
      """
      Compute the proportion of paths that pass outside the two diagonal lines.
  
      Parameters
      ----------
      n : integer
          n > 0
      h : integer
          0 <= h <= n
  
      Returns
      -------
      p : float
          The proportion of paths that pass outside the lines x-y = +/-h.
  
      """
      # Compute Pr(D_{n,n} >= h/n)
      # Prob = 2 * ( binom(2n, n-h) - binom(2n, n-2a) + binom(2n, n-3a) - ... )  / binom(2n, n)
      # This formulation exhibits subtractive cancellation.
      # Instead divide each term by binom(2n, n), then factor common terms
      # and use a Horner-like algorithm
      # P = 2 * A0 * (1 - A1*(1 - A2*(1 - A3*(1 - A4*(...)))))
  
      P = 0.0
      k = int(np.floor(n / h))
      while k >= 0:
          p1 = 1.0
          # Each of the Ai terms has numerator and denominator with h simple terms.
          for j in range(h):
              p1 = (n - k * h - j) * p1 / (n + k * h + j + 1)
          P = p1 * (1.0 - P)
          k -= 1
      return 2 * P
  
file_path: mars/mars/tensor/stats/ks.py
imports: import math
  import warnings
  from math import gcd
  from collections import namedtuple
  from typing import Callable, Tuple, Union
  import numpy
  from scipy import special
  from scipy.stats import distributions
  from ...None import tensor
  from ...core import ExecutableTuple
  from ...typing import TileableType
label_desc: Use image node_id 2 for calling a global function with example usage: _compute_prob_outside_square(n, h) and returns: unknown