docs: def tangent(x, null=(-np.inf, np.inf), rtol=default_rtol, atol=default_atol):
      '''
      tangent(x) is equivalent to tan(x) except that it also works on sparse arrays.
  
      The optional argument null (default, (-numpy.inf, numpy.inf)) may be specified to indicate what
      value(s) should be assigned when x == -pi/2 or -pi/2. If only one number is given, then it is
      used for both values; otherwise the first value corresponds to -pi/2 and the second to pi/2.
      A value of x is considered to be equal to one of these valids based on numpy.isclose. The
      optional arguments rtol and atol are passed along to isclose. If null is None, then no
      replacement is performed.
      '''
      if sps.issparse(x):
          x = x.copy()
          x.data = tangent(x.data, null=null, rtol=rtol, atol=atol)
          return x
      else: x = np.asarray(x)
      if rtol is None: rtol = default_rtol
      if atol is None: atol = default_atol
      try:    (nln,nlp) = null
      except Exception: (nln,nlp) = (null,null)
      x = np.mod(x + pi, tau) - pi
      ii = None if nln is None else np.where(np.isclose(x, neghpi, rtol=rtol, atol=atol))
      jj = None if nlp is None else np.where(np.isclose(x, hpi,    rtol=rtol, atol=atol))
      x = np.tan(x)
      if ii: x[ii] = nln
      if jj: x[jj] = nlp
      return x