Average Error: 18.6 → 0.3
Time: 10.8s
Precision: binary64
Cost: 13512
\[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
\[\begin{array}{l} \mathbf{if}\;y \leq -2600000000:\\ \;\;\;\;\left(1 - \mathsf{log1p}\left(-x\right)\right) + \log \left(-y\right)\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+21}:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\ \end{array} \]
(FPCore (x y) :precision binary64 (- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))
(FPCore (x y)
 :precision binary64
 (if (<= y -2600000000.0)
   (+ (- 1.0 (log1p (- x))) (log (- y)))
   (if (<= y 1.45e+21)
     (- 1.0 (log1p (/ (- y x) (- 1.0 y))))
     (+ 1.0 (- (log y) (log (+ x -1.0)))))))
double code(double x, double y) {
	return 1.0 - log((1.0 - ((x - y) / (1.0 - y))));
}
double code(double x, double y) {
	double tmp;
	if (y <= -2600000000.0) {
		tmp = (1.0 - log1p(-x)) + log(-y);
	} else if (y <= 1.45e+21) {
		tmp = 1.0 - log1p(((y - x) / (1.0 - y)));
	} else {
		tmp = 1.0 + (log(y) - log((x + -1.0)));
	}
	return tmp;
}
public static double code(double x, double y) {
	return 1.0 - Math.log((1.0 - ((x - y) / (1.0 - y))));
}
public static double code(double x, double y) {
	double tmp;
	if (y <= -2600000000.0) {
		tmp = (1.0 - Math.log1p(-x)) + Math.log(-y);
	} else if (y <= 1.45e+21) {
		tmp = 1.0 - Math.log1p(((y - x) / (1.0 - y)));
	} else {
		tmp = 1.0 + (Math.log(y) - Math.log((x + -1.0)));
	}
	return tmp;
}
def code(x, y):
	return 1.0 - math.log((1.0 - ((x - y) / (1.0 - y))))
def code(x, y):
	tmp = 0
	if y <= -2600000000.0:
		tmp = (1.0 - math.log1p(-x)) + math.log(-y)
	elif y <= 1.45e+21:
		tmp = 1.0 - math.log1p(((y - x) / (1.0 - y)))
	else:
		tmp = 1.0 + (math.log(y) - math.log((x + -1.0)))
	return tmp
function code(x, y)
	return Float64(1.0 - log(Float64(1.0 - Float64(Float64(x - y) / Float64(1.0 - y)))))
end
function code(x, y)
	tmp = 0.0
	if (y <= -2600000000.0)
		tmp = Float64(Float64(1.0 - log1p(Float64(-x))) + log(Float64(-y)));
	elseif (y <= 1.45e+21)
		tmp = Float64(1.0 - log1p(Float64(Float64(y - x) / Float64(1.0 - y))));
	else
		tmp = Float64(1.0 + Float64(log(y) - log(Float64(x + -1.0))));
	end
	return tmp
end
code[x_, y_] := N[(1.0 - N[Log[N[(1.0 - N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, y_] := If[LessEqual[y, -2600000000.0], N[(N[(1.0 - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision] + N[Log[(-y)], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.45e+21], N[(1.0 - N[Log[1 + N[(N[(y - x), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Log[y], $MachinePrecision] - N[Log[N[(x + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
1 - \log \left(1 - \frac{x - y}{1 - y}\right)
\begin{array}{l}
\mathbf{if}\;y \leq -2600000000:\\
\;\;\;\;\left(1 - \mathsf{log1p}\left(-x\right)\right) + \log \left(-y\right)\\

\mathbf{elif}\;y \leq 1.45 \cdot 10^{+21}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\

\mathbf{else}:\\
\;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original18.6
Target0.1
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;y < -81284752.61947241:\\ \;\;\;\;1 - \log \left(\frac{x}{y \cdot y} - \left(\frac{1}{y} - \frac{x}{y}\right)\right)\\ \mathbf{elif}\;y < 3.0094271212461764 \cdot 10^{+25}:\\ \;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y \cdot y} - \left(\frac{1}{y} - \frac{x}{y}\right)\right)\\ \end{array} \]

Derivation

  1. Split input into 3 regimes
  2. if y < -2.6e9

    1. Initial program 52.8

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Simplified52.8

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
      Proof
      (-.f64 1 (log1p.f64 (/.f64 (-.f64 y x) (-.f64 1 y)))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite=> div-sub_binary64 (-.f64 (/.f64 y (-.f64 1 y)) (/.f64 x (-.f64 1 y)))))): 0 points increase in error, 1 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (/.f64 y (-.f64 1 y)) (neg.f64 (/.f64 x (-.f64 1 y))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 (/.f64 x (-.f64 1 y))) (/.f64 y (-.f64 1 y)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (+.f64 (Rewrite=> neg-sub0_binary64 (-.f64 0 (/.f64 x (-.f64 1 y)))) (/.f64 y (-.f64 1 y))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite<= associate--r-_binary64 (-.f64 0 (-.f64 (/.f64 x (-.f64 1 y)) (/.f64 y (-.f64 1 y))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (-.f64 0 (Rewrite<= div-sub_binary64 (/.f64 (-.f64 x y) (-.f64 1 y)))))): 1 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 (/.f64 (-.f64 x y) (-.f64 1 y)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (Rewrite<= log1p-def_binary64 (log.f64 (+.f64 1 (neg.f64 (/.f64 (-.f64 x y) (-.f64 1 y))))))): 5 points increase in error, 0 points decrease in error
      (-.f64 1 (log.f64 (Rewrite<= sub-neg_binary64 (-.f64 1 (/.f64 (-.f64 x y) (-.f64 1 y)))))): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in y around -inf 0.4

      \[\leadsto \color{blue}{1 - \left(\log \left(-1 \cdot \left(x - 1\right)\right) + \log \left(\frac{-1}{y}\right)\right)} \]
    4. Simplified0.4

      \[\leadsto \color{blue}{\left(1 - \mathsf{log1p}\left(-x\right)\right) - \log \left(\frac{-1}{y}\right)} \]
      Proof
      (-.f64 (-.f64 1 (log1p.f64 (neg.f64 x))) (log.f64 (/.f64 -1 y))): 0 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 1 (log1p.f64 (Rewrite<= mul-1-neg_binary64 (*.f64 -1 x)))) (log.f64 (/.f64 -1 y))): 0 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 1 (Rewrite<= log1p-def_binary64 (log.f64 (+.f64 1 (*.f64 -1 x))))) (log.f64 (/.f64 -1 y))): 0 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 1 (log.f64 (Rewrite=> +-commutative_binary64 (+.f64 (*.f64 -1 x) 1)))) (log.f64 (/.f64 -1 y))): 0 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 1 (log.f64 (+.f64 (*.f64 -1 x) (Rewrite<= metadata-eval (*.f64 -1 -1))))) (log.f64 (/.f64 -1 y))): 0 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 1 (log.f64 (Rewrite<= distribute-lft-in_binary64 (*.f64 -1 (+.f64 x -1))))) (log.f64 (/.f64 -1 y))): 0 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 1 (log.f64 (*.f64 -1 (+.f64 x (Rewrite<= metadata-eval (neg.f64 1)))))) (log.f64 (/.f64 -1 y))): 0 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 1 (log.f64 (*.f64 -1 (Rewrite<= sub-neg_binary64 (-.f64 x 1))))) (log.f64 (/.f64 -1 y))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--r+_binary64 (-.f64 1 (+.f64 (log.f64 (*.f64 -1 (-.f64 x 1))) (log.f64 (/.f64 -1 y))))): 0 points increase in error, 0 points decrease in error
    5. Taylor expanded in y around 0 64.0

      \[\leadsto \color{blue}{1 - \left(\log -1 + \left(\log \left(1 - x\right) + -1 \cdot \log y\right)\right)} \]
    6. Simplified0.4

      \[\leadsto \color{blue}{\left(1 - \mathsf{log1p}\left(-x\right)\right) + \log \left(-y\right)} \]
      Proof
      (+.f64 (-.f64 1 (log1p.f64 (neg.f64 x))) (log.f64 (neg.f64 y))): 0 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 1 (Rewrite<= log1p-def_binary64 (log.f64 (+.f64 1 (neg.f64 x))))) (log.f64 (neg.f64 y))): 0 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 1 (log.f64 (Rewrite<= sub-neg_binary64 (-.f64 1 x)))) (log.f64 (neg.f64 y))): 0 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 1 (log.f64 (-.f64 1 x))) (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (log.f64 (neg.f64 y)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 1 (log.f64 (-.f64 1 x))) (neg.f64 (Rewrite<= log-rec_binary64 (log.f64 (/.f64 1 (neg.f64 y)))))): 1 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 1 (log.f64 (-.f64 1 x))) (neg.f64 (log.f64 (/.f64 (Rewrite<= metadata-eval (/.f64 -1 -1)) (neg.f64 y))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 1 (log.f64 (-.f64 1 x))) (neg.f64 (log.f64 (Rewrite<= associate-/r*_binary64 (/.f64 -1 (*.f64 -1 (neg.f64 y))))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 1 (log.f64 (-.f64 1 x))) (neg.f64 (log.f64 (/.f64 -1 (Rewrite<= neg-mul-1_binary64 (neg.f64 (neg.f64 y))))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 1 (log.f64 (-.f64 1 x))) (neg.f64 (log.f64 (/.f64 -1 (Rewrite=> remove-double-neg_binary64 y))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= sub-neg_binary64 (-.f64 (-.f64 1 (log.f64 (-.f64 1 x))) (log.f64 (/.f64 -1 y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--r+_binary64 (-.f64 1 (+.f64 (log.f64 (-.f64 1 x)) (log.f64 (/.f64 -1 y))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (Rewrite<= +-commutative_binary64 (+.f64 (log.f64 (/.f64 -1 y)) (log.f64 (-.f64 1 x))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (+.f64 (Rewrite=> log-div_binary64 (-.f64 (log.f64 -1) (log.f64 y))) (log.f64 (-.f64 1 x)))): 158 points increase in error, 0 points decrease in error
      (-.f64 1 (+.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (log.f64 -1) (neg.f64 (log.f64 y)))) (log.f64 (-.f64 1 x)))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (Rewrite<= associate-+r+_binary64 (+.f64 (log.f64 -1) (+.f64 (neg.f64 (log.f64 y)) (log.f64 (-.f64 1 x)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (+.f64 (log.f64 -1) (Rewrite=> +-commutative_binary64 (+.f64 (log.f64 (-.f64 1 x)) (neg.f64 (log.f64 y)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (+.f64 (log.f64 -1) (+.f64 (log.f64 (-.f64 1 x)) (Rewrite=> neg-mul-1_binary64 (*.f64 -1 (log.f64 y)))))): 0 points increase in error, 0 points decrease in error

    if -2.6e9 < y < 1.45e21

    1. Initial program 0.1

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Simplified0.1

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
      Proof
      (-.f64 1 (log1p.f64 (/.f64 (-.f64 y x) (-.f64 1 y)))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite=> div-sub_binary64 (-.f64 (/.f64 y (-.f64 1 y)) (/.f64 x (-.f64 1 y)))))): 0 points increase in error, 1 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (/.f64 y (-.f64 1 y)) (neg.f64 (/.f64 x (-.f64 1 y))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 (/.f64 x (-.f64 1 y))) (/.f64 y (-.f64 1 y)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (+.f64 (Rewrite=> neg-sub0_binary64 (-.f64 0 (/.f64 x (-.f64 1 y)))) (/.f64 y (-.f64 1 y))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite<= associate--r-_binary64 (-.f64 0 (-.f64 (/.f64 x (-.f64 1 y)) (/.f64 y (-.f64 1 y))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (-.f64 0 (Rewrite<= div-sub_binary64 (/.f64 (-.f64 x y) (-.f64 1 y)))))): 1 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 (/.f64 (-.f64 x y) (-.f64 1 y)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (Rewrite<= log1p-def_binary64 (log.f64 (+.f64 1 (neg.f64 (/.f64 (-.f64 x y) (-.f64 1 y))))))): 5 points increase in error, 0 points decrease in error
      (-.f64 1 (log.f64 (Rewrite<= sub-neg_binary64 (-.f64 1 (/.f64 (-.f64 x y) (-.f64 1 y)))))): 0 points increase in error, 0 points decrease in error

    if 1.45e21 < y

    1. Initial program 32.5

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Simplified32.5

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
      Proof
      (-.f64 1 (log1p.f64 (/.f64 (-.f64 y x) (-.f64 1 y)))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite=> div-sub_binary64 (-.f64 (/.f64 y (-.f64 1 y)) (/.f64 x (-.f64 1 y)))))): 0 points increase in error, 1 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (/.f64 y (-.f64 1 y)) (neg.f64 (/.f64 x (-.f64 1 y))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 (/.f64 x (-.f64 1 y))) (/.f64 y (-.f64 1 y)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (+.f64 (Rewrite=> neg-sub0_binary64 (-.f64 0 (/.f64 x (-.f64 1 y)))) (/.f64 y (-.f64 1 y))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite<= associate--r-_binary64 (-.f64 0 (-.f64 (/.f64 x (-.f64 1 y)) (/.f64 y (-.f64 1 y))))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (-.f64 0 (Rewrite<= div-sub_binary64 (/.f64 (-.f64 x y) (-.f64 1 y)))))): 1 points increase in error, 0 points decrease in error
      (-.f64 1 (log1p.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 (/.f64 (-.f64 x y) (-.f64 1 y)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 1 (Rewrite<= log1p-def_binary64 (log.f64 (+.f64 1 (neg.f64 (/.f64 (-.f64 x y) (-.f64 1 y))))))): 5 points increase in error, 0 points decrease in error
      (-.f64 1 (log.f64 (Rewrite<= sub-neg_binary64 (-.f64 1 (/.f64 (-.f64 x y) (-.f64 1 y)))))): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in y around inf 0.9

      \[\leadsto 1 - \color{blue}{\left(\log \left(\frac{1}{y}\right) + \log \left(x - 1\right)\right)} \]
    4. Simplified0.9

      \[\leadsto 1 - \color{blue}{\left(\log \left(-1 + x\right) - \log y\right)} \]
      Proof
      (-.f64 (log.f64 (+.f64 -1 x)) (log.f64 y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (log.f64 (Rewrite<= +-commutative_binary64 (+.f64 x -1))) (log.f64 y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (log.f64 (+.f64 x (Rewrite<= metadata-eval (neg.f64 1)))) (log.f64 y)): 0 points increase in error, 0 points decrease in error
      (-.f64 (log.f64 (Rewrite<= sub-neg_binary64 (-.f64 x 1))) (log.f64 y)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= unsub-neg_binary64 (+.f64 (log.f64 (-.f64 x 1)) (neg.f64 (log.f64 y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (log.f64 (-.f64 x 1)) (Rewrite<= log-rec_binary64 (log.f64 (/.f64 1 y)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (log.f64 (/.f64 1 y)) (log.f64 (-.f64 x 1)))): 0 points increase in error, 0 points decrease in error
  3. Recombined 3 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2600000000:\\ \;\;\;\;\left(1 - \mathsf{log1p}\left(-x\right)\right) + \log \left(-y\right)\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+21}:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\ \end{array} \]

Alternatives

Alternative 1
Error0.3
Cost13448
\[\begin{array}{l} \mathbf{if}\;y \leq -2700000000:\\ \;\;\;\;\left(1 - \mathsf{log1p}\left(-x\right)\right) + \log \left(-y\right)\\ \mathbf{elif}\;y \leq 0.4:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(\frac{e \cdot \left(y + -1\right)}{x}\right)\\ \end{array} \]
Alternative 2
Error5.9
Cost7620
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{1 - y} \leq 0.99999996:\\ \;\;\;\;1 - \mathsf{log1p}\left(\left(y - x\right) \cdot \frac{1}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \log \left(-y\right)\\ \end{array} \]
Alternative 3
Error5.9
Cost7492
\[\begin{array}{l} \mathbf{if}\;\frac{x - y}{1 - y} \leq 0.99999996:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \log \left(-y\right)\\ \end{array} \]
Alternative 4
Error7.9
Cost7376
\[\begin{array}{l} t_0 := \log \left(-y\right)\\ t_1 := 1 - \log \left(\frac{x}{y + -1}\right)\\ \mathbf{if}\;y \leq -1.1 \cdot 10^{+155}:\\ \;\;\;\;1 + t_0\\ \mathbf{elif}\;y \leq -4.6 \cdot 10^{+83}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -10.5:\\ \;\;\;\;1 + \left(x + t_0\right)\\ \mathbf{elif}\;y \leq 0.07:\\ \;\;\;\;\left(1 - y\right) - \mathsf{log1p}\left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error10.1
Cost7312
\[\begin{array}{l} t_0 := \log \left(-y\right)\\ t_1 := 1 - \mathsf{log1p}\left(\frac{x}{y}\right)\\ \mathbf{if}\;y \leq -4.8 \cdot 10^{+125}:\\ \;\;\;\;1 + t_0\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{+84}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -5:\\ \;\;\;\;1 + \left(x + t_0\right)\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;\left(1 - y\right) - \mathsf{log1p}\left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error10.5
Cost7248
\[\begin{array}{l} t_0 := 1 + \log \left(-y\right)\\ t_1 := 1 - \mathsf{log1p}\left(\frac{x}{y}\right)\\ \mathbf{if}\;y \leq -4.8 \cdot 10^{+125}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.5 \cdot 10^{+84}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -8.6:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error10.5
Cost7248
\[\begin{array}{l} t_0 := \log \left(-y\right)\\ t_1 := 1 - \mathsf{log1p}\left(\frac{x}{y}\right)\\ \mathbf{if}\;y \leq -2.6 \cdot 10^{+126}:\\ \;\;\;\;1 + t_0\\ \mathbf{elif}\;y \leq -2.2 \cdot 10^{+84}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -12:\\ \;\;\;\;1 + \left(x + t_0\right)\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error24.9
Cost6788
\[\begin{array}{l} \mathbf{if}\;y \leq -2.9:\\ \;\;\;\;1 + \log \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{x}{1 - y}\\ \end{array} \]
Alternative 9
Error13.2
Cost6788
\[\begin{array}{l} \mathbf{if}\;y \leq -12:\\ \;\;\;\;1 + \log \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\ \end{array} \]
Alternative 10
Error35.7
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -12:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 + \left(x - y\right)\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 11
Error35.4
Cost584
\[\begin{array}{l} t_0 := 1 - \frac{x}{y}\\ \mathbf{if}\;y \leq -10:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 + \left(x - y\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 12
Error35.7
Cost448
\[1 + \frac{x}{1 - y} \]
Alternative 13
Error36.8
Cost64
\[1 \]

Error

Reproduce

herbie shell --seed 2022329 
(FPCore (x y)
  :name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
  :precision binary64

  :herbie-target
  (if (< y -81284752.61947241) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y))))) (if (< y 3.0094271212461764e+25) (log (/ (exp 1.0) (- 1.0 (/ (- x y) (- 1.0 y))))) (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y)))))))

  (- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))