def METHOD_NAME(x, a, b, loc=0, scale=1):
  x, a, b, loc, scale = promote_args_inexact("truncnorm.logcdf", x, a, b, loc, scale)
  x, a, b = jnp.broadcast_arrays(x, a, b)
  x = lax.div(lax.sub(x, loc), scale)
  METHOD_NAME = _log_gauss_mass(a, x) - _log_gauss_mass(a, b)
  logsf = _log_gauss_mass(x, b) - _log_gauss_mass(a, b)
  METHOD_NAME = jnp.select(
    # third condition: avoid catastrophic cancellation (from scipy)
    [x >= b, x <= a, METHOD_NAME > -0.1, x > a],
    [0, -jnp.inf, jnp.log1p(-jnp.exp(logsf)), METHOD_NAME]
  )
  METHOD_NAME = jnp.where(a >= b, jnp.nan, METHOD_NAME)
  return METHOD_NAME