code: public static double sumLogProbs(double probPos, double probNeg) {
          if (probPos > probNeg) {
              return probPos + Math.log(Math.exp(probNeg - probPos) + 1);
          } else {
              return probNeg + Math.log(Math.exp(probPos - probNeg) + 1);
          }
      }
docs: For more general formula, see http://blog.smola.org/post/987977550/log-probabilities-semirings-and-floating-point-numbers