public static double log1mexp(double x) {
    return (x > -LOG2) ? FastMath.log(-FastMath.expm1(x)) : FastMath.log1p(-exp(x));
  }
public static double log1mexp ( double x ) { return ( x > - LOG2 ) ? FastMath . log ( - FastMath . expm1 ( x ) ) : FastMath . log1p ( - exp ( x ) ) ; }
More stable than {@code FastMath.log(1 - FastMath.exp(x))}

@param x Value
@return log(1-exp(x))