?

Average Error: 28.43% → 0.36%
Time: 16.2s
Precision: binary64
Cost: 14340

?

\[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
\[\begin{array}{l} \mathbf{if}\;y \leq -680000:\\ \;\;\;\;\left(1 - \frac{\frac{x}{x + -1} + \frac{-1}{x + -1}}{y}\right) - \left(\mathsf{log1p}\left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\\ \mathbf{elif}\;y \leq 0.08:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y + -1}\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 -680000.0)
   (-
    (- 1.0 (/ (+ (/ x (+ x -1.0)) (/ -1.0 (+ x -1.0))) y))
    (+ (log1p (- x)) (log (/ -1.0 y))))
   (if (<= y 0.08)
     (- 1.0 (log1p (/ (- y x) (- 1.0 y))))
     (- 1.0 (log (/ x (+ y -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 <= -680000.0) {
		tmp = (1.0 - (((x / (x + -1.0)) + (-1.0 / (x + -1.0))) / y)) - (log1p(-x) + log((-1.0 / y)));
	} else if (y <= 0.08) {
		tmp = 1.0 - log1p(((y - x) / (1.0 - y)));
	} else {
		tmp = 1.0 - log((x / (y + -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 <= -680000.0) {
		tmp = (1.0 - (((x / (x + -1.0)) + (-1.0 / (x + -1.0))) / y)) - (Math.log1p(-x) + Math.log((-1.0 / y)));
	} else if (y <= 0.08) {
		tmp = 1.0 - Math.log1p(((y - x) / (1.0 - y)));
	} else {
		tmp = 1.0 - Math.log((x / (y + -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 <= -680000.0:
		tmp = (1.0 - (((x / (x + -1.0)) + (-1.0 / (x + -1.0))) / y)) - (math.log1p(-x) + math.log((-1.0 / y)))
	elif y <= 0.08:
		tmp = 1.0 - math.log1p(((y - x) / (1.0 - y)))
	else:
		tmp = 1.0 - math.log((x / (y + -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 <= -680000.0)
		tmp = Float64(Float64(1.0 - Float64(Float64(Float64(x / Float64(x + -1.0)) + Float64(-1.0 / Float64(x + -1.0))) / y)) - Float64(log1p(Float64(-x)) + log(Float64(-1.0 / y))));
	elseif (y <= 0.08)
		tmp = Float64(1.0 - log1p(Float64(Float64(y - x) / Float64(1.0 - y))));
	else
		tmp = Float64(1.0 - log(Float64(x / Float64(y + -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, -680000.0], N[(N[(1.0 - N[(N[(N[(x / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - N[(N[Log[1 + (-x)], $MachinePrecision] + N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.08], 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 / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
1 - \log \left(1 - \frac{x - y}{1 - y}\right)
\begin{array}{l}
\mathbf{if}\;y \leq -680000:\\
\;\;\;\;\left(1 - \frac{\frac{x}{x + -1} + \frac{-1}{x + -1}}{y}\right) - \left(\mathsf{log1p}\left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\\

\mathbf{elif}\;y \leq 0.08:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original28.43%
Target0.2%
Herbie0.36%
\[\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 < -6.8e5

    1. Initial program 81.67

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

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

      [Start]81.67

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

      sub-neg [=>]81.67

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

      log1p-def [=>]81.67

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

      div-sub [=>]81.66

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

      sub-neg [=>]81.66

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

      +-commutative [=>]81.66

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

      distribute-neg-in [=>]81.66

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

      remove-double-neg [=>]81.66

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

      sub-neg [<=]81.66

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

      div-sub [<=]81.67

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

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

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

      [Start]0.51

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

      mul-1-neg [=>]0.51

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

      unsub-neg [=>]0.51

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

      sub-neg [=>]0.51

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

      sub-neg [=>]0.51

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

      metadata-eval [=>]0.51

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

      +-commutative [=>]0.51

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

      distribute-neg-frac [=>]0.51

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

      metadata-eval [=>]0.51

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

      sub-neg [=>]0.51

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

      metadata-eval [=>]0.51

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

      +-commutative [=>]0.51

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

    if -6.8e5 < y < 0.0800000000000000017

    1. Initial program 0.08

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

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

      [Start]0.08

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

      sub-neg [=>]0.08

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

      log1p-def [=>]0.05

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

      div-sub [=>]0.05

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

      sub-neg [=>]0.05

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

      +-commutative [=>]0.05

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

      distribute-neg-in [=>]0.05

      \[ 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.05

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

      sub-neg [<=]0.05

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

      div-sub [<=]0.05

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

    if 0.0800000000000000017 < y

    1. Initial program 46.79

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

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

      [Start]46.79

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

      sub-neg [=>]46.79

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

      log1p-def [=>]46.79

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

      div-sub [=>]46.76

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

      sub-neg [=>]46.76

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

      +-commutative [=>]46.76

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

      distribute-neg-in [=>]46.76

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

      remove-double-neg [=>]46.76

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

      sub-neg [<=]46.76

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

      div-sub [<=]46.79

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{1 - y}}\right) \]
    4. Simplified45.81

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

      [Start]45.81

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

      mul-1-neg [=>]45.81

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

      distribute-neg-frac [=>]45.81

      \[ 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    5. Applied egg-rr45.81

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{1 + \left(\frac{x}{-1 + y} - 1\right)}\right) \]
    6. Simplified45.81

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

      [Start]45.81

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

      associate-+r- [=>]45.81

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

      +-commutative [=>]45.81

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

      associate--l+ [=>]45.81

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

      metadata-eval [=>]45.81

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

      +-rgt-identity [=>]45.81

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

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

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

      [Start]3.34

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

      sub-neg [=>]3.34

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

      metadata-eval [=>]3.34

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

      +-commutative [<=]3.34

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

      log-rec [=>]3.34

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

      sub-neg [<=]3.34

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

      mul-1-neg [=>]3.34

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

      log-rec [=>]3.34

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

      remove-double-neg [=>]3.34

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

      log-div [<=]1.88

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

      +-commutative [=>]1.88

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

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

Alternatives

Alternative 1
Error0.36%
Cost14084
\[\begin{array}{l} \mathbf{if}\;y \leq -490000:\\ \;\;\;\;1 + \left(\left(\frac{1 - x}{y \cdot \left(x + -1\right)} - \log \left(\frac{-1}{y}\right)\right) - \mathsf{log1p}\left(-x\right)\right)\\ \mathbf{elif}\;y \leq 0.08:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y + -1}\right)\\ \end{array} \]
Alternative 2
Error0.47%
Cost13444
\[\begin{array}{l} \mathbf{if}\;y \leq -520000000:\\ \;\;\;\;1 - \left(\mathsf{log1p}\left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\\ \mathbf{elif}\;y \leq 0.08:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y + -1}\right)\\ \end{array} \]
Alternative 3
Error9.9%
Cost7240
\[\begin{array}{l} \mathbf{if}\;y \leq -16500000000:\\ \;\;\;\;\left(1 + x\right) - \log \left(\frac{-1}{y}\right)\\ \mathbf{elif}\;y \leq 0.08:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y + -1}\right)\\ \end{array} \]
Alternative 4
Error9.2%
Cost7240
\[\begin{array}{l} \mathbf{if}\;y \leq -330000000:\\ \;\;\;\;1 + \left(\frac{-1}{y} - \log \left(\frac{-1}{y}\right)\right)\\ \mathbf{elif}\;y \leq 0.08:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y + -1}\right)\\ \end{array} \]
Alternative 5
Error9.22%
Cost7240
\[\begin{array}{l} \mathbf{if}\;y \leq -25000000000:\\ \;\;\;\;\left(1 + \frac{-1}{y}\right) - \log \left(\frac{-1}{y}\right)\\ \mathbf{elif}\;y \leq 0.08:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{x}{y + -1}\right)\\ \end{array} \]
Alternative 6
Error18.47%
Cost7113
\[\begin{array}{l} \mathbf{if}\;x \leq -17000 \lor \neg \left(x \leq 1\right):\\ \;\;\;\;1 - \log \left(\frac{x}{y + -1}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\ \end{array} \]
Alternative 7
Error11.05%
Cost7112
\[\begin{array}{l} t_0 := \frac{x}{y + -1}\\ \mathbf{if}\;y \leq -4100000:\\ \;\;\;\;\left(1 + x\right) - \log \left(\frac{-1}{y}\right)\\ \mathbf{elif}\;y \leq 0.08:\\ \;\;\;\;1 - \mathsf{log1p}\left(t_0\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log t_0\\ \end{array} \]
Alternative 8
Error26.67%
Cost7049
\[\begin{array}{l} \mathbf{if}\;y \leq -2.3 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \left(y + \mathsf{log1p}\left(-x\right)\right)\\ \end{array} \]
Alternative 9
Error27.24%
Cost6985
\[\begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\ \end{array} \]
Alternative 10
Error36.46%
Cost6656
\[1 - \mathsf{log1p}\left(-x\right) \]
Alternative 11
Error54.68%
Cost448
\[1 + \frac{x}{1 - y} \]
Alternative 12
Error56.42%
Cost64
\[1 \]

Error

Reproduce?

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