Average Error: 18.5 → 0.2
Time: 9.4s
Precision: binary64
Cost: 14084
\[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
\[\begin{array}{l} \mathbf{if}\;y \leq -460000:\\ \;\;\;\;1 - \left(\mathsf{log1p}\left(-x\right) + \left(\log \left(\frac{-1}{y}\right) - \frac{1 - x}{y \cdot \left(x + -1\right)}\right)\right)\\ \mathbf{elif}\;y \leq 10^{+15}:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y}\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 -460000.0)
   (-
    1.0
    (+ (log1p (- x)) (- (log (/ -1.0 y)) (/ (- 1.0 x) (* y (+ x -1.0))))))
   (if (<= y 1e+15)
     (- 1.0 (log1p (/ (- y x) (- 1.0 y))))
     (- 1.0 (log (/ x y))))))
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 <= -460000.0) {
		tmp = 1.0 - (log1p(-x) + (log((-1.0 / y)) - ((1.0 - x) / (y * (x + -1.0)))));
	} else if (y <= 1e+15) {
		tmp = 1.0 - log1p(((y - x) / (1.0 - y)));
	} else {
		tmp = 1.0 - log((x / y));
	}
	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 <= -460000.0) {
		tmp = 1.0 - (Math.log1p(-x) + (Math.log((-1.0 / y)) - ((1.0 - x) / (y * (x + -1.0)))));
	} else if (y <= 1e+15) {
		tmp = 1.0 - Math.log1p(((y - x) / (1.0 - y)));
	} else {
		tmp = 1.0 - Math.log((x / y));
	}
	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 <= -460000.0:
		tmp = 1.0 - (math.log1p(-x) + (math.log((-1.0 / y)) - ((1.0 - x) / (y * (x + -1.0)))))
	elif y <= 1e+15:
		tmp = 1.0 - math.log1p(((y - x) / (1.0 - y)))
	else:
		tmp = 1.0 - math.log((x / y))
	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 <= -460000.0)
		tmp = Float64(1.0 - Float64(log1p(Float64(-x)) + Float64(log(Float64(-1.0 / y)) - Float64(Float64(1.0 - x) / Float64(y * Float64(x + -1.0))))));
	elseif (y <= 1e+15)
		tmp = Float64(1.0 - log1p(Float64(Float64(y - x) / Float64(1.0 - y))));
	else
		tmp = Float64(1.0 - log(Float64(x / y)));
	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, -460000.0], N[(1.0 - N[(N[Log[1 + (-x)], $MachinePrecision] + N[(N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision] - N[(N[(1.0 - x), $MachinePrecision] / N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+15], N[(1.0 - N[Log[1 + N[(N[(y - x), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
1 - \log \left(1 - \frac{x - y}{1 - y}\right)
\begin{array}{l}
\mathbf{if}\;y \leq -460000:\\
\;\;\;\;1 - \left(\mathsf{log1p}\left(-x\right) + \left(\log \left(\frac{-1}{y}\right) - \frac{1 - x}{y \cdot \left(x + -1\right)}\right)\right)\\

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

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


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original18.5
Target0.1
Herbie0.2
\[\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 < -4.6e5

    1. Initial program 52.4

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

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
      Proof

      [Start]52.4

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

      sub-neg [=>]52.4

      \[ 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]

      log1p-def [=>]52.4

      \[ 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]

      div-sub [=>]52.4

      \[ 1 - \mathsf{log1p}\left(-\color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]

      sub-neg [=>]52.4

      \[ 1 - \mathsf{log1p}\left(-\color{blue}{\left(\frac{x}{1 - y} + \left(-\frac{y}{1 - y}\right)\right)}\right) \]

      +-commutative [=>]52.4

      \[ 1 - \mathsf{log1p}\left(-\color{blue}{\left(\left(-\frac{y}{1 - y}\right) + \frac{x}{1 - y}\right)}\right) \]

      distribute-neg-in [=>]52.4

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\left(-\left(-\frac{y}{1 - y}\right)\right) + \left(-\frac{x}{1 - y}\right)}\right) \]

      remove-double-neg [=>]52.4

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y}} + \left(-\frac{x}{1 - y}\right)\right) \]

      sub-neg [<=]52.4

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]

      div-sub [<=]52.4

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Taylor expanded in y around -inf 0.3

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

      \[\leadsto 1 - \color{blue}{\left(\mathsf{log1p}\left(-x\right) + \left(\log \left(\frac{-1}{y}\right) - \frac{1 - x}{y \cdot \left(-1 + x\right)}\right)\right)} \]
      Proof

      [Start]0.3

      \[ 1 - \left(\log \left(-1 \cdot \left(x - 1\right)\right) + \left(\log \left(\frac{-1}{y}\right) + -1 \cdot \frac{\frac{1}{x - 1} - \frac{x}{x - 1}}{y}\right)\right) \]

      sub-neg [=>]0.3

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

      metadata-eval [=>]0.3

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

      distribute-lft-in [=>]0.3

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

      metadata-eval [=>]0.3

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

      +-commutative [<=]0.3

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

      log1p-def [=>]0.3

      \[ 1 - \left(\color{blue}{\mathsf{log1p}\left(-1 \cdot x\right)} + \left(\log \left(\frac{-1}{y}\right) + -1 \cdot \frac{\frac{1}{x - 1} - \frac{x}{x - 1}}{y}\right)\right) \]

      mul-1-neg [=>]0.3

      \[ 1 - \left(\mathsf{log1p}\left(\color{blue}{-x}\right) + \left(\log \left(\frac{-1}{y}\right) + -1 \cdot \frac{\frac{1}{x - 1} - \frac{x}{x - 1}}{y}\right)\right) \]

      mul-1-neg [=>]0.3

      \[ 1 - \left(\mathsf{log1p}\left(-x\right) + \left(\log \left(\frac{-1}{y}\right) + \color{blue}{\left(-\frac{\frac{1}{x - 1} - \frac{x}{x - 1}}{y}\right)}\right)\right) \]

      unsub-neg [=>]0.3

      \[ 1 - \left(\mathsf{log1p}\left(-x\right) + \color{blue}{\left(\log \left(\frac{-1}{y}\right) - \frac{\frac{1}{x - 1} - \frac{x}{x - 1}}{y}\right)}\right) \]

      div-sub [<=]0.3

      \[ 1 - \left(\mathsf{log1p}\left(-x\right) + \left(\log \left(\frac{-1}{y}\right) - \frac{\color{blue}{\frac{1 - x}{x - 1}}}{y}\right)\right) \]

      associate-/l/ [=>]0.3

      \[ 1 - \left(\mathsf{log1p}\left(-x\right) + \left(\log \left(\frac{-1}{y}\right) - \color{blue}{\frac{1 - x}{y \cdot \left(x - 1\right)}}\right)\right) \]

      sub-neg [=>]0.3

      \[ 1 - \left(\mathsf{log1p}\left(-x\right) + \left(\log \left(\frac{-1}{y}\right) - \frac{1 - x}{y \cdot \color{blue}{\left(x + \left(-1\right)\right)}}\right)\right) \]

      metadata-eval [=>]0.3

      \[ 1 - \left(\mathsf{log1p}\left(-x\right) + \left(\log \left(\frac{-1}{y}\right) - \frac{1 - x}{y \cdot \left(x + \color{blue}{-1}\right)}\right)\right) \]

      +-commutative [=>]0.3

      \[ 1 - \left(\mathsf{log1p}\left(-x\right) + \left(\log \left(\frac{-1}{y}\right) - \frac{1 - x}{y \cdot \color{blue}{\left(-1 + x\right)}}\right)\right) \]

    if -4.6e5 < y < 1e15

    1. Initial program 0.1

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

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
      Proof

      [Start]0.1

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

      sub-neg [=>]0.1

      \[ 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]

      log1p-def [=>]0.0

      \[ 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]

      div-sub [=>]0.0

      \[ 1 - \mathsf{log1p}\left(-\color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]

      sub-neg [=>]0.0

      \[ 1 - \mathsf{log1p}\left(-\color{blue}{\left(\frac{x}{1 - y} + \left(-\frac{y}{1 - y}\right)\right)}\right) \]

      +-commutative [=>]0.0

      \[ 1 - \mathsf{log1p}\left(-\color{blue}{\left(\left(-\frac{y}{1 - y}\right) + \frac{x}{1 - y}\right)}\right) \]

      distribute-neg-in [=>]0.0

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\left(-\left(-\frac{y}{1 - y}\right)\right) + \left(-\frac{x}{1 - y}\right)}\right) \]

      remove-double-neg [=>]0.0

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y}} + \left(-\frac{x}{1 - y}\right)\right) \]

      sub-neg [<=]0.0

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]

      div-sub [<=]0.0

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]

    if 1e15 < y

    1. Initial program 30.6

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

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
      Proof

      [Start]30.6

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

      sub-neg [=>]30.6

      \[ 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]

      log1p-def [=>]30.6

      \[ 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]

      div-sub [=>]30.6

      \[ 1 - \mathsf{log1p}\left(-\color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]

      sub-neg [=>]30.6

      \[ 1 - \mathsf{log1p}\left(-\color{blue}{\left(\frac{x}{1 - y} + \left(-\frac{y}{1 - y}\right)\right)}\right) \]

      +-commutative [=>]30.6

      \[ 1 - \mathsf{log1p}\left(-\color{blue}{\left(\left(-\frac{y}{1 - y}\right) + \frac{x}{1 - y}\right)}\right) \]

      distribute-neg-in [=>]30.6

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\left(-\left(-\frac{y}{1 - y}\right)\right) + \left(-\frac{x}{1 - y}\right)}\right) \]

      remove-double-neg [=>]30.6

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y}} + \left(-\frac{x}{1 - y}\right)\right) \]

      sub-neg [<=]30.6

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]

      div-sub [<=]30.6

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Applied egg-rr56.6

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{\left(\left(y - x\right) \cdot \left(y + x\right)\right) \cdot \frac{1}{1 - y}}{\left(y - x\right) \cdot \left(y + x\right)} \cdot \left(y - x\right)}\right) \]
    4. Taylor expanded in y around inf 29.8

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-1}{y}} \cdot \left(y - x\right)\right) \]
    5. Applied egg-rr32.8

      \[\leadsto 1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\mathsf{log1p}\left(\frac{y - x}{-y}\right)\right)} - 1\right)} \]
    6. Simplified0.7

      \[\leadsto 1 - \color{blue}{\log \left(\frac{x}{y}\right)} \]
      Proof

      [Start]32.8

      \[ 1 - \left(e^{\mathsf{log1p}\left(\mathsf{log1p}\left(\frac{y - x}{-y}\right)\right)} - 1\right) \]

      expm1-def [=>]32.8

      \[ 1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{log1p}\left(\frac{y - x}{-y}\right)\right)\right)} \]

      expm1-log1p [=>]30.6

      \[ 1 - \color{blue}{\mathsf{log1p}\left(\frac{y - x}{-y}\right)} \]

      log1p-def [<=]30.6

      \[ 1 - \color{blue}{\log \left(1 + \frac{y - x}{-y}\right)} \]

      div-sub [=>]30.6

      \[ 1 - \log \left(1 + \color{blue}{\left(\frac{y}{-y} - \frac{x}{-y}\right)}\right) \]

      *-lft-identity [<=]30.6

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

      associate-+r- [=>]0.7

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

      associate-*r/ [=>]0.7

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

      neg-mul-1 [=>]0.7

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

      times-frac [=>]0.7

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

      metadata-eval [=>]0.7

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

      *-inverses [=>]0.7

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

      metadata-eval [=>]0.7

      \[ 1 - \log \left(\left(1 + \color{blue}{-1}\right) - \frac{x}{-y}\right) \]

      metadata-eval [=>]0.7

      \[ 1 - \log \left(\color{blue}{0} - \frac{x}{-y}\right) \]

      neg-sub0 [<=]0.7

      \[ 1 - \log \color{blue}{\left(-\frac{x}{-y}\right)} \]

      distribute-frac-neg [<=]0.7

      \[ 1 - \log \color{blue}{\left(\frac{-x}{-y}\right)} \]

      mul-1-neg [<=]0.7

      \[ 1 - \log \left(\frac{\color{blue}{-1 \cdot x}}{-y}\right) \]

      *-commutative [=>]0.7

      \[ 1 - \log \left(\frac{\color{blue}{x \cdot -1}}{-y}\right) \]

      associate-/l* [=>]0.7

      \[ 1 - \log \color{blue}{\left(\frac{x}{\frac{-y}{-1}}\right)} \]

      neg-mul-1 [=>]0.7

      \[ 1 - \log \left(\frac{x}{\frac{\color{blue}{-1 \cdot y}}{-1}}\right) \]

      associate-/l* [=>]0.7

      \[ 1 - \log \left(\frac{x}{\color{blue}{\frac{-1}{\frac{-1}{y}}}}\right) \]

      metadata-eval [<=]0.7

      \[ 1 - \log \left(\frac{x}{\frac{-1}{\frac{\color{blue}{\frac{1}{-1}}}{y}}}\right) \]

      associate-/r* [<=]0.7

      \[ 1 - \log \left(\frac{x}{\frac{-1}{\color{blue}{\frac{1}{-1 \cdot y}}}}\right) \]

      neg-mul-1 [<=]0.7

      \[ 1 - \log \left(\frac{x}{\frac{-1}{\frac{1}{\color{blue}{-y}}}}\right) \]

      associate-/l* [<=]0.7

      \[ 1 - \log \left(\frac{x}{\color{blue}{\frac{-1 \cdot \left(-y\right)}{1}}}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.2

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

Alternatives

Alternative 1
Error0.2
Cost13444
\[\begin{array}{l} \mathbf{if}\;y \leq -265000000000:\\ \;\;\;\;1 - \left(\mathsf{log1p}\left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{+15}:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y}\right)\\ \end{array} \]
Alternative 2
Error6.1
Cost7240
\[\begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{+22}:\\ \;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{+15}:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y}\right)\\ \end{array} \]
Alternative 3
Error6.9
Cost7112
\[\begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{+22}:\\ \;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\ \mathbf{elif}\;y \leq 4000000000000:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{x}{y + -1}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y}\right)\\ \end{array} \]
Alternative 4
Error6.6
Cost7048
\[\begin{array}{l} \mathbf{if}\;y \leq -26:\\ \;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 - \left(y + \mathsf{log1p}\left(-x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y}\right)\\ \end{array} \]
Alternative 5
Error7.0
Cost6984
\[\begin{array}{l} \mathbf{if}\;y \leq -108:\\ \;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y}\right)\\ \end{array} \]
Alternative 6
Error13.6
Cost6852
\[\begin{array}{l} \mathbf{if}\;y \leq -26:\\ \;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\ \end{array} \]
Alternative 7
Error24.1
Cost6656
\[1 - \mathsf{log1p}\left(-x\right) \]
Alternative 8
Error36.0
Cost64
\[1 \]

Error

Reproduce

herbie shell --seed 2023016 
(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))))))