Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B

Percentage Accurate: 71.2% → 99.1%
Time: 9.9s
Alternatives: 12
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ 1 - \log \left(1 - \frac{x - y}{1 - y}\right) \end{array} \]
(FPCore (x y) :precision binary64 (- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))
double code(double x, double y) {
	return 1.0 - log((1.0 - ((x - y) / (1.0 - y))));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 - log((1.0d0 - ((x - y) / (1.0d0 - y))))
end function
public static double code(double x, double y) {
	return 1.0 - Math.log((1.0 - ((x - y) / (1.0 - y))));
}
def code(x, y):
	return 1.0 - math.log((1.0 - ((x - y) / (1.0 - y))))
function code(x, y)
	return Float64(1.0 - log(Float64(1.0 - Float64(Float64(x - y) / Float64(1.0 - y)))))
end
function tmp = code(x, y)
	tmp = 1.0 - log((1.0 - ((x - y) / (1.0 - y))));
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]
\begin{array}{l}

\\
1 - \log \left(1 - \frac{x - y}{1 - y}\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 71.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 1 - \log \left(1 - \frac{x - y}{1 - y}\right) \end{array} \]
(FPCore (x y) :precision binary64 (- 1.0 (log (- 1.0 (/ (- x y) (- 1.0 y))))))
double code(double x, double y) {
	return 1.0 - log((1.0 - ((x - y) / (1.0 - y))));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 - log((1.0d0 - ((x - y) / (1.0d0 - y))))
end function
public static double code(double x, double y) {
	return 1.0 - Math.log((1.0 - ((x - y) / (1.0 - y))));
}
def code(x, y):
	return 1.0 - math.log((1.0 - ((x - y) / (1.0 - y))))
function code(x, y)
	return Float64(1.0 - log(Float64(1.0 - Float64(Float64(x - y) / Float64(1.0 - y)))))
end
function tmp = code(x, y)
	tmp = 1.0 - log((1.0 - ((x - y) / (1.0 - y))));
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]
\begin{array}{l}

\\
1 - \log \left(1 - \frac{x - y}{1 - y}\right)
\end{array}

Alternative 1: 99.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+19}:\\ \;\;\;\;1 - \left(\mathsf{log1p}\left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\\ \mathbf{elif}\;y \leq 30000000000000:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -9.5e+19)
   (- 1.0 (+ (log1p (- x)) (log (/ -1.0 y))))
   (if (<= y 30000000000000.0)
     (- 1.0 (log1p (/ (- y x) (- 1.0 y))))
     (+ 1.0 (- (log y) (log (+ x -1.0)))))))
double code(double x, double y) {
	double tmp;
	if (y <= -9.5e+19) {
		tmp = 1.0 - (log1p(-x) + log((-1.0 / y)));
	} else if (y <= 30000000000000.0) {
		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) {
	double tmp;
	if (y <= -9.5e+19) {
		tmp = 1.0 - (Math.log1p(-x) + Math.log((-1.0 / y)));
	} else if (y <= 30000000000000.0) {
		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):
	tmp = 0
	if y <= -9.5e+19:
		tmp = 1.0 - (math.log1p(-x) + math.log((-1.0 / y)))
	elif y <= 30000000000000.0:
		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)
	tmp = 0.0
	if (y <= -9.5e+19)
		tmp = Float64(1.0 - Float64(log1p(Float64(-x)) + log(Float64(-1.0 / y))));
	elseif (y <= 30000000000000.0)
		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_] := If[LessEqual[y, -9.5e+19], N[(1.0 - N[(N[Log[1 + (-x)], $MachinePrecision] + N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 30000000000000.0], 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]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+19}:\\
\;\;\;\;1 - \left(\mathsf{log1p}\left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.5e19

    1. Initial program 11.7%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg11.7%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def11.7%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub011.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub011.7%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified11.7%

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

      \[\leadsto 1 - \color{blue}{\left(\log \left(-1 \cdot \left(x - 1\right)\right) + \log \left(\frac{-1}{y}\right)\right)} \]
    5. Step-by-step derivation
      1. sub-neg99.5%

        \[\leadsto 1 - \left(\log \left(-1 \cdot \color{blue}{\left(x + \left(-1\right)\right)}\right) + \log \left(\frac{-1}{y}\right)\right) \]
      2. metadata-eval99.5%

        \[\leadsto 1 - \left(\log \left(-1 \cdot \left(x + \color{blue}{-1}\right)\right) + \log \left(\frac{-1}{y}\right)\right) \]
      3. distribute-lft-in99.5%

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

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

        \[\leadsto 1 - \left(\log \color{blue}{\left(1 + -1 \cdot x\right)} + \log \left(\frac{-1}{y}\right)\right) \]
      6. log1p-def99.5%

        \[\leadsto 1 - \left(\color{blue}{\mathsf{log1p}\left(-1 \cdot x\right)} + \log \left(\frac{-1}{y}\right)\right) \]
      7. mul-1-neg99.5%

        \[\leadsto 1 - \left(\mathsf{log1p}\left(\color{blue}{-x}\right) + \log \left(\frac{-1}{y}\right)\right) \]
    6. Simplified99.5%

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

    if -9.5e19 < y < 3e13

    1. Initial program 100.0%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def100.0%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub0100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub0100.0%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified100.0%

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

    if 3e13 < y

    1. Initial program 62.9%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg62.9%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def62.9%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub062.9%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub62.9%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-62.9%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub062.9%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\frac{x}{1 - y}\right)} + \frac{y}{1 - y}\right) \]
      7. +-commutative62.9%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg62.9%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub62.9%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified62.9%

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

      \[\leadsto 1 - \color{blue}{\left(\log \left(\frac{1}{y}\right) + \log \left(x - 1\right)\right)} \]
    5. Step-by-step derivation
      1. +-commutative98.0%

        \[\leadsto 1 - \color{blue}{\left(\log \left(x - 1\right) + \log \left(\frac{1}{y}\right)\right)} \]
      2. log-rec98.0%

        \[\leadsto 1 - \left(\log \left(x - 1\right) + \color{blue}{\left(-\log y\right)}\right) \]
      3. unsub-neg98.0%

        \[\leadsto 1 - \color{blue}{\left(\log \left(x - 1\right) - \log y\right)} \]
      4. sub-neg98.0%

        \[\leadsto 1 - \left(\log \color{blue}{\left(x + \left(-1\right)\right)} - \log y\right) \]
      5. metadata-eval98.0%

        \[\leadsto 1 - \left(\log \left(x + \color{blue}{-1}\right) - \log y\right) \]
      6. +-commutative98.0%

        \[\leadsto 1 - \left(\log \color{blue}{\left(-1 + x\right)} - \log y\right) \]
    6. Simplified98.0%

      \[\leadsto 1 - \color{blue}{\left(\log \left(-1 + x\right) - \log y\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.7%

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

Alternative 2: 71.3% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x - y}{1 - y} \leq 1:\\ \;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= (/ (- x y) (- 1.0 y)) 1.0)
   (- 1.0 (log1p (/ (- y x) (- 1.0 y))))
   (- 1.0 (log (/ -1.0 y)))))
double code(double x, double y) {
	double tmp;
	if (((x - y) / (1.0 - y)) <= 1.0) {
		tmp = 1.0 - log1p(((y - x) / (1.0 - y)));
	} else {
		tmp = 1.0 - log((-1.0 / y));
	}
	return tmp;
}
public static double code(double x, double y) {
	double tmp;
	if (((x - y) / (1.0 - y)) <= 1.0) {
		tmp = 1.0 - Math.log1p(((y - x) / (1.0 - y)));
	} else {
		tmp = 1.0 - Math.log((-1.0 / y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if ((x - y) / (1.0 - y)) <= 1.0:
		tmp = 1.0 - math.log1p(((y - x) / (1.0 - y)))
	else:
		tmp = 1.0 - math.log((-1.0 / y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (Float64(Float64(x - y) / Float64(1.0 - y)) <= 1.0)
		tmp = Float64(1.0 - log1p(Float64(Float64(y - x) / Float64(1.0 - y))));
	else
		tmp = Float64(1.0 - log(Float64(-1.0 / y)));
	end
	return tmp
end
code[x_, y_] := If[LessEqual[N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision], 1.0], 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[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \leq 1:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 x y) (-.f64 1 y)) < 1

    1. Initial program 73.3%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg73.3%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def73.4%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub073.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub73.4%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-73.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub073.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\frac{x}{1 - y}\right)} + \frac{y}{1 - y}\right) \]
      7. +-commutative73.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg73.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub73.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified73.4%

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

    if 1 < (/.f64 (-.f64 x y) (-.f64 1 y))

    1. Initial program 73.3%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg73.3%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def73.4%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub073.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub73.4%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-73.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub073.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\frac{x}{1 - y}\right)} + \frac{y}{1 - y}\right) \]
      7. +-commutative73.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg73.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub73.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified73.4%

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
    4. Taylor expanded in x around 0 45.0%

      \[\leadsto 1 - \color{blue}{\log \left(1 + \frac{y}{1 - y}\right)} \]
    5. Step-by-step derivation
      1. log1p-def45.0%

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

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

      \[\leadsto 1 - \color{blue}{\left(\log -1 + \log \left(\frac{1}{y}\right)\right)} \]
    8. Step-by-step derivation
      1. log-rec0.0%

        \[\leadsto 1 - \left(\log -1 + \color{blue}{\left(-\log y\right)}\right) \]
      2. sub-neg0.0%

        \[\leadsto 1 - \color{blue}{\left(\log -1 - \log y\right)} \]
      3. log-div21.7%

        \[\leadsto 1 - \color{blue}{\log \left(\frac{-1}{y}\right)} \]
    9. Simplified21.7%

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

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

Alternative 3: 89.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+19}:\\ \;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\ \mathbf{elif}\;y \leq -1.38 \cdot 10^{-5} \lor \neg \left(y \leq 10^{-5}\right):\\ \;\;\;\;1 - \log \left(\frac{x}{y + -1}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \left(y + \mathsf{log1p}\left(-x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -9.5e+19)
   (- 1.0 (log (/ -1.0 y)))
   (if (or (<= y -1.38e-5) (not (<= y 1e-5)))
     (- 1.0 (log (/ x (+ y -1.0))))
     (- 1.0 (+ y (log1p (- x)))))))
double code(double x, double y) {
	double tmp;
	if (y <= -9.5e+19) {
		tmp = 1.0 - log((-1.0 / y));
	} else if ((y <= -1.38e-5) || !(y <= 1e-5)) {
		tmp = 1.0 - log((x / (y + -1.0)));
	} else {
		tmp = 1.0 - (y + log1p(-x));
	}
	return tmp;
}
public static double code(double x, double y) {
	double tmp;
	if (y <= -9.5e+19) {
		tmp = 1.0 - Math.log((-1.0 / y));
	} else if ((y <= -1.38e-5) || !(y <= 1e-5)) {
		tmp = 1.0 - Math.log((x / (y + -1.0)));
	} else {
		tmp = 1.0 - (y + Math.log1p(-x));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -9.5e+19:
		tmp = 1.0 - math.log((-1.0 / y))
	elif (y <= -1.38e-5) or not (y <= 1e-5):
		tmp = 1.0 - math.log((x / (y + -1.0)))
	else:
		tmp = 1.0 - (y + math.log1p(-x))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -9.5e+19)
		tmp = Float64(1.0 - log(Float64(-1.0 / y)));
	elseif ((y <= -1.38e-5) || !(y <= 1e-5))
		tmp = Float64(1.0 - log(Float64(x / Float64(y + -1.0))));
	else
		tmp = Float64(1.0 - Float64(y + log1p(Float64(-x))));
	end
	return tmp
end
code[x_, y_] := If[LessEqual[y, -9.5e+19], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -1.38e-5], N[Not[LessEqual[y, 1e-5]], $MachinePrecision]], N[(1.0 - N[Log[N[(x / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(y + N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+19}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\

\mathbf{elif}\;y \leq -1.38 \cdot 10^{-5} \lor \neg \left(y \leq 10^{-5}\right):\\
\;\;\;\;1 - \log \left(\frac{x}{y + -1}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.5e19

    1. Initial program 11.7%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg11.7%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def11.7%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub011.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub011.7%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified11.7%

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
    4. Taylor expanded in x around 0 2.9%

      \[\leadsto 1 - \color{blue}{\log \left(1 + \frac{y}{1 - y}\right)} \]
    5. Step-by-step derivation
      1. log1p-def2.9%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(\frac{y}{1 - y}\right)} \]
    6. Simplified2.9%

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

      \[\leadsto 1 - \color{blue}{\left(\log -1 + \log \left(\frac{1}{y}\right)\right)} \]
    8. Step-by-step derivation
      1. log-rec0.0%

        \[\leadsto 1 - \left(\log -1 + \color{blue}{\left(-\log y\right)}\right) \]
      2. sub-neg0.0%

        \[\leadsto 1 - \color{blue}{\left(\log -1 - \log y\right)} \]
      3. log-div74.2%

        \[\leadsto 1 - \color{blue}{\log \left(\frac{-1}{y}\right)} \]
    9. Simplified74.2%

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

    if -9.5e19 < y < -1.38e-5 or 1.00000000000000008e-5 < y

    1. Initial program 71.8%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg71.8%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def71.8%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub071.8%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub71.8%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-71.8%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub071.8%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\frac{x}{1 - y}\right)} + \frac{y}{1 - y}\right) \]
      7. +-commutative71.8%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg71.8%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub71.8%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified71.8%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{1 - y}}\right) \]
    5. Step-by-step derivation
      1. neg-mul-169.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-\frac{x}{1 - y}}\right) \]
      2. distribute-neg-frac69.7%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    7. Step-by-step derivation
      1. frac-2neg69.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-\left(-x\right)}{-\left(1 - y\right)}}\right) \]
      2. div-inv69.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\left(-x\right)\right) \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
      3. remove-double-neg69.7%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{x \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
    9. Step-by-step derivation
      1. associate-*r/69.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{x \cdot 1}{-\left(1 - y\right)}}\right) \]
      2. *-rgt-identity69.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{\color{blue}{x}}{-\left(1 - y\right)}\right) \]
      3. neg-sub069.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{0 - \left(1 - y\right)}}\right) \]
      4. associate--r-69.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{\left(0 - 1\right) + y}}\right) \]
      5. metadata-eval69.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{-1} + y}\right) \]
    10. Simplified69.7%

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

      \[\leadsto 1 - \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) + \log \left(\frac{1}{y - 1}\right)\right)} \]
    12. Step-by-step derivation
      1. log-rec78.0%

        \[\leadsto 1 - \left(-1 \cdot \log \left(\frac{1}{x}\right) + \color{blue}{\left(-\log \left(y - 1\right)\right)}\right) \]
      2. unsub-neg78.0%

        \[\leadsto 1 - \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) - \log \left(y - 1\right)\right)} \]
      3. mul-1-neg78.0%

        \[\leadsto 1 - \left(\color{blue}{\left(-\log \left(\frac{1}{x}\right)\right)} - \log \left(y - 1\right)\right) \]
      4. log-rec78.0%

        \[\leadsto 1 - \left(\left(-\color{blue}{\left(-\log x\right)}\right) - \log \left(y - 1\right)\right) \]
      5. remove-double-neg78.0%

        \[\leadsto 1 - \left(\color{blue}{\log x} - \log \left(y - 1\right)\right) \]
      6. sub-neg78.0%

        \[\leadsto 1 - \left(\log x - \log \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      7. metadata-eval78.0%

        \[\leadsto 1 - \left(\log x - \log \left(y + \color{blue}{-1}\right)\right) \]
      8. +-commutative78.0%

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

        \[\leadsto 1 - \color{blue}{\log \left(\frac{x}{-1 + y}\right)} \]
      10. rem-exp-log78.3%

        \[\leadsto 1 - \log \left(\frac{\color{blue}{e^{\log x}}}{-1 + y}\right) \]
      11. rem-exp-log78.0%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{\color{blue}{e^{\log \left(-1 + y\right)}}}\right) \]
      12. +-commutative78.0%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \color{blue}{\left(y + -1\right)}}}\right) \]
      13. metadata-eval78.0%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \left(y + \color{blue}{\left(-1\right)}\right)}}\right) \]
      14. sub-neg78.0%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \color{blue}{\left(y - 1\right)}}}\right) \]
      15. rem-exp-log78.7%

        \[\leadsto 1 - \log \left(\frac{\color{blue}{x}}{e^{\log \left(y - 1\right)}}\right) \]
      16. sub-neg78.7%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \color{blue}{\left(y + \left(-1\right)\right)}}}\right) \]
      17. metadata-eval78.7%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \left(y + \color{blue}{-1}\right)}}\right) \]
      18. +-commutative78.7%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \color{blue}{\left(-1 + y\right)}}}\right) \]
      19. rem-exp-log96.9%

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

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

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

    if -1.38e-5 < y < 1.00000000000000008e-5

    1. Initial program 100.0%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def100.0%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub0100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub0100.0%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
    4. Step-by-step derivation
      1. flip--100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{y - x}{\color{blue}{\frac{1 \cdot 1 - y \cdot y}{1 + y}}}\right) \]
      2. associate-/r/100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 \cdot 1 - y \cdot y} \cdot \left(1 + y\right)}\right) \]
      3. metadata-eval100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{y - x}{\color{blue}{1} - y \cdot y} \cdot \left(1 + y\right)\right) \]
      4. +-commutative100.0%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y \cdot y} \cdot \left(y + 1\right)}\right) \]
    6. Taylor expanded in y around 0 99.8%

      \[\leadsto 1 - \color{blue}{\left(y + \log \left(1 + -1 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. log1p-def99.8%

        \[\leadsto 1 - \left(y + \color{blue}{\mathsf{log1p}\left(-1 \cdot x\right)}\right) \]
      2. mul-1-neg99.8%

        \[\leadsto 1 - \left(y + \mathsf{log1p}\left(\color{blue}{-x}\right)\right) \]
    8. Simplified99.8%

      \[\leadsto 1 - \color{blue}{\left(y + \mathsf{log1p}\left(-x\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.7%

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

Alternative 4: 89.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{y + -1}\\ \mathbf{if}\;y \leq -1.02 \cdot 10^{+20}:\\ \;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 - \mathsf{log1p}\left(t_0\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \log t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ x (+ y -1.0))))
   (if (<= y -1.02e+20)
     (- 1.0 (log (/ -1.0 y)))
     (if (<= y 1.0) (- 1.0 (log1p t_0)) (- 1.0 (log t_0))))))
double code(double x, double y) {
	double t_0 = x / (y + -1.0);
	double tmp;
	if (y <= -1.02e+20) {
		tmp = 1.0 - log((-1.0 / y));
	} else if (y <= 1.0) {
		tmp = 1.0 - log1p(t_0);
	} else {
		tmp = 1.0 - log(t_0);
	}
	return tmp;
}
public static double code(double x, double y) {
	double t_0 = x / (y + -1.0);
	double tmp;
	if (y <= -1.02e+20) {
		tmp = 1.0 - Math.log((-1.0 / y));
	} else if (y <= 1.0) {
		tmp = 1.0 - Math.log1p(t_0);
	} else {
		tmp = 1.0 - Math.log(t_0);
	}
	return tmp;
}
def code(x, y):
	t_0 = x / (y + -1.0)
	tmp = 0
	if y <= -1.02e+20:
		tmp = 1.0 - math.log((-1.0 / y))
	elif y <= 1.0:
		tmp = 1.0 - math.log1p(t_0)
	else:
		tmp = 1.0 - math.log(t_0)
	return tmp
function code(x, y)
	t_0 = Float64(x / Float64(y + -1.0))
	tmp = 0.0
	if (y <= -1.02e+20)
		tmp = Float64(1.0 - log(Float64(-1.0 / y)));
	elseif (y <= 1.0)
		tmp = Float64(1.0 - log1p(t_0));
	else
		tmp = Float64(1.0 - log(t_0));
	end
	return tmp
end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.02e+20], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 - N[Log[1 + t$95$0], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[t$95$0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x}{y + -1}\\
\mathbf{if}\;y \leq -1.02 \cdot 10^{+20}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\

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

\mathbf{else}:\\
\;\;\;\;1 - \log t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.02e20

    1. Initial program 11.7%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg11.7%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def11.7%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub011.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub011.7%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified11.7%

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
    4. Taylor expanded in x around 0 2.9%

      \[\leadsto 1 - \color{blue}{\log \left(1 + \frac{y}{1 - y}\right)} \]
    5. Step-by-step derivation
      1. log1p-def2.9%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(\frac{y}{1 - y}\right)} \]
    6. Simplified2.9%

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

      \[\leadsto 1 - \color{blue}{\left(\log -1 + \log \left(\frac{1}{y}\right)\right)} \]
    8. Step-by-step derivation
      1. log-rec0.0%

        \[\leadsto 1 - \left(\log -1 + \color{blue}{\left(-\log y\right)}\right) \]
      2. sub-neg0.0%

        \[\leadsto 1 - \color{blue}{\left(\log -1 - \log y\right)} \]
      3. log-div74.2%

        \[\leadsto 1 - \color{blue}{\log \left(\frac{-1}{y}\right)} \]
    9. Simplified74.2%

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

    if -1.02e20 < y < 1

    1. Initial program 100.0%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def100.0%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub0100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub0100.0%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified100.0%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{1 - y}}\right) \]
    5. Step-by-step derivation
      1. neg-mul-199.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-\frac{x}{1 - y}}\right) \]
      2. distribute-neg-frac99.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    6. Simplified99.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    7. Step-by-step derivation
      1. frac-2neg99.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-\left(-x\right)}{-\left(1 - y\right)}}\right) \]
      2. div-inv99.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\left(-x\right)\right) \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
      3. remove-double-neg99.4%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{x \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
    9. Step-by-step derivation
      1. associate-*r/99.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{x \cdot 1}{-\left(1 - y\right)}}\right) \]
      2. *-rgt-identity99.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{\color{blue}{x}}{-\left(1 - y\right)}\right) \]
      3. neg-sub099.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{0 - \left(1 - y\right)}}\right) \]
      4. associate--r-99.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{\left(0 - 1\right) + y}}\right) \]
      5. metadata-eval99.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{-1} + y}\right) \]
    10. Simplified99.4%

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

    if 1 < y

    1. Initial program 66.0%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg66.0%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def66.0%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub066.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub66.0%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-66.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub066.0%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg66.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub66.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified66.0%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{1 - y}}\right) \]
    5. Step-by-step derivation
      1. neg-mul-163.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-\frac{x}{1 - y}}\right) \]
      2. distribute-neg-frac63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    6. Simplified63.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    7. Step-by-step derivation
      1. frac-2neg63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-\left(-x\right)}{-\left(1 - y\right)}}\right) \]
      2. div-inv63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\left(-x\right)\right) \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
      3. remove-double-neg63.4%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{x \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
    9. Step-by-step derivation
      1. associate-*r/63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{x \cdot 1}{-\left(1 - y\right)}}\right) \]
      2. *-rgt-identity63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{\color{blue}{x}}{-\left(1 - y\right)}\right) \]
      3. neg-sub063.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{0 - \left(1 - y\right)}}\right) \]
      4. associate--r-63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{\left(0 - 1\right) + y}}\right) \]
      5. metadata-eval63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{-1} + y}\right) \]
    10. Simplified63.4%

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

      \[\leadsto 1 - \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) + \log \left(\frac{1}{y - 1}\right)\right)} \]
    12. Step-by-step derivation
      1. log-rec94.3%

        \[\leadsto 1 - \left(-1 \cdot \log \left(\frac{1}{x}\right) + \color{blue}{\left(-\log \left(y - 1\right)\right)}\right) \]
      2. unsub-neg94.3%

        \[\leadsto 1 - \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) - \log \left(y - 1\right)\right)} \]
      3. mul-1-neg94.3%

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

        \[\leadsto 1 - \left(\left(-\color{blue}{\left(-\log x\right)}\right) - \log \left(y - 1\right)\right) \]
      5. remove-double-neg94.3%

        \[\leadsto 1 - \left(\color{blue}{\log x} - \log \left(y - 1\right)\right) \]
      6. sub-neg94.3%

        \[\leadsto 1 - \left(\log x - \log \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      7. metadata-eval94.3%

        \[\leadsto 1 - \left(\log x - \log \left(y + \color{blue}{-1}\right)\right) \]
      8. +-commutative94.3%

        \[\leadsto 1 - \left(\log x - \log \color{blue}{\left(-1 + y\right)}\right) \]
      9. log-div96.2%

        \[\leadsto 1 - \color{blue}{\log \left(\frac{x}{-1 + y}\right)} \]
      10. rem-exp-log94.6%

        \[\leadsto 1 - \log \left(\frac{\color{blue}{e^{\log x}}}{-1 + y}\right) \]
      11. rem-exp-log94.3%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{\color{blue}{e^{\log \left(-1 + y\right)}}}\right) \]
      12. +-commutative94.3%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \color{blue}{\left(y + -1\right)}}}\right) \]
      13. metadata-eval94.3%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \left(y + \color{blue}{\left(-1\right)}\right)}}\right) \]
      14. sub-neg94.3%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \color{blue}{\left(y - 1\right)}}}\right) \]
      15. rem-exp-log95.1%

        \[\leadsto 1 - \log \left(\frac{\color{blue}{x}}{e^{\log \left(y - 1\right)}}\right) \]
      16. sub-neg95.1%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \color{blue}{\left(y + \left(-1\right)\right)}}}\right) \]
      17. metadata-eval95.1%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \left(y + \color{blue}{-1}\right)}}\right) \]
      18. +-commutative95.1%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \color{blue}{\left(-1 + y\right)}}}\right) \]
      19. rem-exp-log96.2%

        \[\leadsto 1 - \log \left(\frac{x}{\color{blue}{-1 + y}}\right) \]
      20. +-commutative96.2%

        \[\leadsto 1 - \log \left(\frac{x}{\color{blue}{y + -1}}\right) \]
    13. Simplified96.2%

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

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

Alternative 5: 89.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -8.2:\\ \;\;\;\;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} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -8.2)
   (- 1.0 (log (/ -1.0 y)))
   (if (<= y 1.0) (- 1.0 (+ y (log1p (- x)))) (- 1.0 (log (/ x y))))))
double code(double x, double y) {
	double tmp;
	if (y <= -8.2) {
		tmp = 1.0 - log((-1.0 / y));
	} else if (y <= 1.0) {
		tmp = 1.0 - (y + log1p(-x));
	} else {
		tmp = 1.0 - log((x / y));
	}
	return tmp;
}
public static double code(double x, double y) {
	double tmp;
	if (y <= -8.2) {
		tmp = 1.0 - Math.log((-1.0 / y));
	} else if (y <= 1.0) {
		tmp = 1.0 - (y + Math.log1p(-x));
	} else {
		tmp = 1.0 - Math.log((x / y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -8.2:
		tmp = 1.0 - math.log((-1.0 / y))
	elif y <= 1.0:
		tmp = 1.0 - (y + math.log1p(-x))
	else:
		tmp = 1.0 - math.log((x / y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -8.2)
		tmp = Float64(1.0 - log(Float64(-1.0 / y)));
	elseif (y <= 1.0)
		tmp = Float64(1.0 - Float64(y + log1p(Float64(-x))));
	else
		tmp = Float64(1.0 - log(Float64(x / y)));
	end
	return tmp
end
code[x_, y_] := If[LessEqual[y, -8.2], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 - N[(y + N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -8.1999999999999993

    1. Initial program 16.6%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg16.6%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def16.6%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub016.6%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub16.6%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-16.6%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub016.6%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg16.6%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub16.6%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified16.6%

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
    4. Taylor expanded in x around 0 2.8%

      \[\leadsto 1 - \color{blue}{\log \left(1 + \frac{y}{1 - y}\right)} \]
    5. Step-by-step derivation
      1. log1p-def2.8%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(\frac{y}{1 - y}\right)} \]
    6. Simplified2.8%

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

      \[\leadsto 1 - \color{blue}{\left(\log -1 + \log \left(\frac{1}{y}\right)\right)} \]
    8. Step-by-step derivation
      1. log-rec0.0%

        \[\leadsto 1 - \left(\log -1 + \color{blue}{\left(-\log y\right)}\right) \]
      2. sub-neg0.0%

        \[\leadsto 1 - \color{blue}{\left(\log -1 - \log y\right)} \]
      3. log-div70.2%

        \[\leadsto 1 - \color{blue}{\log \left(\frac{-1}{y}\right)} \]
    9. Simplified70.2%

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

    if -8.1999999999999993 < y < 1

    1. Initial program 100.0%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def100.0%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub0100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub0100.0%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
    4. Step-by-step derivation
      1. flip--100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{y - x}{\color{blue}{\frac{1 \cdot 1 - y \cdot y}{1 + y}}}\right) \]
      2. associate-/r/100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 \cdot 1 - y \cdot y} \cdot \left(1 + y\right)}\right) \]
      3. metadata-eval100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{y - x}{\color{blue}{1} - y \cdot y} \cdot \left(1 + y\right)\right) \]
      4. +-commutative100.0%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y \cdot y} \cdot \left(y + 1\right)}\right) \]
    6. Taylor expanded in y around 0 99.7%

      \[\leadsto 1 - \color{blue}{\left(y + \log \left(1 + -1 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. log1p-def99.7%

        \[\leadsto 1 - \left(y + \color{blue}{\mathsf{log1p}\left(-1 \cdot x\right)}\right) \]
      2. mul-1-neg99.7%

        \[\leadsto 1 - \left(y + \mathsf{log1p}\left(\color{blue}{-x}\right)\right) \]
    8. Simplified99.7%

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

    if 1 < y

    1. Initial program 66.0%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg66.0%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def66.0%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub066.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub66.0%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-66.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub066.0%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg66.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub66.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified66.0%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{1 - y}}\right) \]
    5. Step-by-step derivation
      1. neg-mul-163.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-\frac{x}{1 - y}}\right) \]
      2. distribute-neg-frac63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    6. Simplified63.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    7. Step-by-step derivation
      1. frac-2neg63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-\left(-x\right)}{-\left(1 - y\right)}}\right) \]
      2. div-inv63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\left(-x\right)\right) \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
      3. remove-double-neg63.4%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{x \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
    9. Step-by-step derivation
      1. associate-*r/63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{x \cdot 1}{-\left(1 - y\right)}}\right) \]
      2. *-rgt-identity63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{\color{blue}{x}}{-\left(1 - y\right)}\right) \]
      3. neg-sub063.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{0 - \left(1 - y\right)}}\right) \]
      4. associate--r-63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{\left(0 - 1\right) + y}}\right) \]
      5. metadata-eval63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{-1} + y}\right) \]
    10. Simplified63.4%

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

      \[\leadsto 1 - \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) + \log \left(\frac{1}{y - 1}\right)\right)} \]
    12. Step-by-step derivation
      1. log-rec94.3%

        \[\leadsto 1 - \left(-1 \cdot \log \left(\frac{1}{x}\right) + \color{blue}{\left(-\log \left(y - 1\right)\right)}\right) \]
      2. unsub-neg94.3%

        \[\leadsto 1 - \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) - \log \left(y - 1\right)\right)} \]
      3. mul-1-neg94.3%

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

        \[\leadsto 1 - \left(\left(-\color{blue}{\left(-\log x\right)}\right) - \log \left(y - 1\right)\right) \]
      5. remove-double-neg94.3%

        \[\leadsto 1 - \left(\color{blue}{\log x} - \log \left(y - 1\right)\right) \]
      6. sub-neg94.3%

        \[\leadsto 1 - \left(\log x - \log \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      7. metadata-eval94.3%

        \[\leadsto 1 - \left(\log x - \log \left(y + \color{blue}{-1}\right)\right) \]
      8. +-commutative94.3%

        \[\leadsto 1 - \left(\log x - \log \color{blue}{\left(-1 + y\right)}\right) \]
      9. log-div96.2%

        \[\leadsto 1 - \color{blue}{\log \left(\frac{x}{-1 + y}\right)} \]
      10. rem-exp-log94.6%

        \[\leadsto 1 - \log \left(\frac{\color{blue}{e^{\log x}}}{-1 + y}\right) \]
      11. rem-exp-log94.3%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{\color{blue}{e^{\log \left(-1 + y\right)}}}\right) \]
      12. +-commutative94.3%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \color{blue}{\left(y + -1\right)}}}\right) \]
      13. metadata-eval94.3%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \left(y + \color{blue}{\left(-1\right)}\right)}}\right) \]
      14. sub-neg94.3%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \color{blue}{\left(y - 1\right)}}}\right) \]
      15. rem-exp-log95.1%

        \[\leadsto 1 - \log \left(\frac{\color{blue}{x}}{e^{\log \left(y - 1\right)}}\right) \]
      16. sub-neg95.1%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \color{blue}{\left(y + \left(-1\right)\right)}}}\right) \]
      17. metadata-eval95.1%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \left(y + \color{blue}{-1}\right)}}\right) \]
      18. +-commutative95.1%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \color{blue}{\left(-1 + y\right)}}}\right) \]
      19. rem-exp-log96.2%

        \[\leadsto 1 - \log \left(\frac{x}{\color{blue}{-1 + y}}\right) \]
      20. +-commutative96.2%

        \[\leadsto 1 - \log \left(\frac{x}{\color{blue}{y + -1}}\right) \]
    13. Simplified96.2%

      \[\leadsto 1 - \color{blue}{\log \left(\frac{x}{y + -1}\right)} \]
    14. Taylor expanded in y around inf 94.8%

      \[\leadsto 1 - \log \color{blue}{\left(\frac{x}{y}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.2:\\ \;\;\;\;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 6: 88.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+19}:\\ \;\;\;\;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} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -9.5e+19)
   (- 1.0 (log (/ -1.0 y)))
   (if (<= y 1.0) (- 1.0 (log1p (- x))) (- 1.0 (log (/ x y))))))
double code(double x, double y) {
	double tmp;
	if (y <= -9.5e+19) {
		tmp = 1.0 - log((-1.0 / y));
	} else if (y <= 1.0) {
		tmp = 1.0 - log1p(-x);
	} else {
		tmp = 1.0 - log((x / y));
	}
	return tmp;
}
public static double code(double x, double y) {
	double tmp;
	if (y <= -9.5e+19) {
		tmp = 1.0 - Math.log((-1.0 / y));
	} else if (y <= 1.0) {
		tmp = 1.0 - Math.log1p(-x);
	} else {
		tmp = 1.0 - Math.log((x / y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -9.5e+19:
		tmp = 1.0 - math.log((-1.0 / y))
	elif y <= 1.0:
		tmp = 1.0 - math.log1p(-x)
	else:
		tmp = 1.0 - math.log((x / y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -9.5e+19)
		tmp = Float64(1.0 - log(Float64(-1.0 / y)));
	elseif (y <= 1.0)
		tmp = Float64(1.0 - log1p(Float64(-x)));
	else
		tmp = Float64(1.0 - log(Float64(x / y)));
	end
	return tmp
end
code[x_, y_] := If[LessEqual[y, -9.5e+19], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+19}:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.5e19

    1. Initial program 11.7%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg11.7%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def11.7%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub011.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub011.7%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified11.7%

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
    4. Taylor expanded in x around 0 2.9%

      \[\leadsto 1 - \color{blue}{\log \left(1 + \frac{y}{1 - y}\right)} \]
    5. Step-by-step derivation
      1. log1p-def2.9%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(\frac{y}{1 - y}\right)} \]
    6. Simplified2.9%

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

      \[\leadsto 1 - \color{blue}{\left(\log -1 + \log \left(\frac{1}{y}\right)\right)} \]
    8. Step-by-step derivation
      1. log-rec0.0%

        \[\leadsto 1 - \left(\log -1 + \color{blue}{\left(-\log y\right)}\right) \]
      2. sub-neg0.0%

        \[\leadsto 1 - \color{blue}{\left(\log -1 - \log y\right)} \]
      3. log-div74.2%

        \[\leadsto 1 - \color{blue}{\log \left(\frac{-1}{y}\right)} \]
    9. Simplified74.2%

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

    if -9.5e19 < y < 1

    1. Initial program 100.0%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def100.0%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub0100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub0100.0%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub100.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
    4. Taylor expanded in y around 0 97.0%

      \[\leadsto 1 - \color{blue}{\log \left(1 + -1 \cdot x\right)} \]
    5. Step-by-step derivation
      1. log1p-def97.0%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-1 \cdot x\right)} \]
      2. mul-1-neg97.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-x}\right) \]
    6. Simplified97.0%

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

    if 1 < y

    1. Initial program 66.0%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg66.0%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def66.0%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub066.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub66.0%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-66.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub066.0%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg66.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub66.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified66.0%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{1 - y}}\right) \]
    5. Step-by-step derivation
      1. neg-mul-163.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-\frac{x}{1 - y}}\right) \]
      2. distribute-neg-frac63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    6. Simplified63.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    7. Step-by-step derivation
      1. frac-2neg63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-\left(-x\right)}{-\left(1 - y\right)}}\right) \]
      2. div-inv63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\left(-x\right)\right) \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
      3. remove-double-neg63.4%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{x \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
    9. Step-by-step derivation
      1. associate-*r/63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{x \cdot 1}{-\left(1 - y\right)}}\right) \]
      2. *-rgt-identity63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{\color{blue}{x}}{-\left(1 - y\right)}\right) \]
      3. neg-sub063.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{0 - \left(1 - y\right)}}\right) \]
      4. associate--r-63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{\left(0 - 1\right) + y}}\right) \]
      5. metadata-eval63.4%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{-1} + y}\right) \]
    10. Simplified63.4%

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

      \[\leadsto 1 - \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) + \log \left(\frac{1}{y - 1}\right)\right)} \]
    12. Step-by-step derivation
      1. log-rec94.3%

        \[\leadsto 1 - \left(-1 \cdot \log \left(\frac{1}{x}\right) + \color{blue}{\left(-\log \left(y - 1\right)\right)}\right) \]
      2. unsub-neg94.3%

        \[\leadsto 1 - \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) - \log \left(y - 1\right)\right)} \]
      3. mul-1-neg94.3%

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

        \[\leadsto 1 - \left(\left(-\color{blue}{\left(-\log x\right)}\right) - \log \left(y - 1\right)\right) \]
      5. remove-double-neg94.3%

        \[\leadsto 1 - \left(\color{blue}{\log x} - \log \left(y - 1\right)\right) \]
      6. sub-neg94.3%

        \[\leadsto 1 - \left(\log x - \log \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      7. metadata-eval94.3%

        \[\leadsto 1 - \left(\log x - \log \left(y + \color{blue}{-1}\right)\right) \]
      8. +-commutative94.3%

        \[\leadsto 1 - \left(\log x - \log \color{blue}{\left(-1 + y\right)}\right) \]
      9. log-div96.2%

        \[\leadsto 1 - \color{blue}{\log \left(\frac{x}{-1 + y}\right)} \]
      10. rem-exp-log94.6%

        \[\leadsto 1 - \log \left(\frac{\color{blue}{e^{\log x}}}{-1 + y}\right) \]
      11. rem-exp-log94.3%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{\color{blue}{e^{\log \left(-1 + y\right)}}}\right) \]
      12. +-commutative94.3%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \color{blue}{\left(y + -1\right)}}}\right) \]
      13. metadata-eval94.3%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \left(y + \color{blue}{\left(-1\right)}\right)}}\right) \]
      14. sub-neg94.3%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \color{blue}{\left(y - 1\right)}}}\right) \]
      15. rem-exp-log95.1%

        \[\leadsto 1 - \log \left(\frac{\color{blue}{x}}{e^{\log \left(y - 1\right)}}\right) \]
      16. sub-neg95.1%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \color{blue}{\left(y + \left(-1\right)\right)}}}\right) \]
      17. metadata-eval95.1%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \left(y + \color{blue}{-1}\right)}}\right) \]
      18. +-commutative95.1%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \color{blue}{\left(-1 + y\right)}}}\right) \]
      19. rem-exp-log96.2%

        \[\leadsto 1 - \log \left(\frac{x}{\color{blue}{-1 + y}}\right) \]
      20. +-commutative96.2%

        \[\leadsto 1 - \log \left(\frac{x}{\color{blue}{y + -1}}\right) \]
    13. Simplified96.2%

      \[\leadsto 1 - \color{blue}{\log \left(\frac{x}{y + -1}\right)} \]
    14. Taylor expanded in y around inf 94.8%

      \[\leadsto 1 - \log \color{blue}{\left(\frac{x}{y}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+19}:\\ \;\;\;\;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 7: 78.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+19}:\\ \;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -9.5e+19) (- 1.0 (log (/ -1.0 y))) (- 1.0 (log1p (- x)))))
double code(double x, double y) {
	double tmp;
	if (y <= -9.5e+19) {
		tmp = 1.0 - log((-1.0 / y));
	} else {
		tmp = 1.0 - log1p(-x);
	}
	return tmp;
}
public static double code(double x, double y) {
	double tmp;
	if (y <= -9.5e+19) {
		tmp = 1.0 - Math.log((-1.0 / y));
	} else {
		tmp = 1.0 - Math.log1p(-x);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -9.5e+19:
		tmp = 1.0 - math.log((-1.0 / y))
	else:
		tmp = 1.0 - math.log1p(-x)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -9.5e+19)
		tmp = Float64(1.0 - log(Float64(-1.0 / y)));
	else
		tmp = Float64(1.0 - log1p(Float64(-x)));
	end
	return tmp
end
code[x_, y_] := If[LessEqual[y, -9.5e+19], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+19}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\

\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.5e19

    1. Initial program 11.7%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg11.7%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def11.7%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub011.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub011.7%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub11.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified11.7%

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
    4. Taylor expanded in x around 0 2.9%

      \[\leadsto 1 - \color{blue}{\log \left(1 + \frac{y}{1 - y}\right)} \]
    5. Step-by-step derivation
      1. log1p-def2.9%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(\frac{y}{1 - y}\right)} \]
    6. Simplified2.9%

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

      \[\leadsto 1 - \color{blue}{\left(\log -1 + \log \left(\frac{1}{y}\right)\right)} \]
    8. Step-by-step derivation
      1. log-rec0.0%

        \[\leadsto 1 - \left(\log -1 + \color{blue}{\left(-\log y\right)}\right) \]
      2. sub-neg0.0%

        \[\leadsto 1 - \color{blue}{\left(\log -1 - \log y\right)} \]
      3. log-div74.2%

        \[\leadsto 1 - \color{blue}{\log \left(\frac{-1}{y}\right)} \]
    9. Simplified74.2%

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

    if -9.5e19 < y

    1. Initial program 95.6%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg95.6%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def95.7%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub095.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub95.7%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-95.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub095.7%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg95.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub95.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified95.7%

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
    4. Taylor expanded in y around 0 84.6%

      \[\leadsto 1 - \color{blue}{\log \left(1 + -1 \cdot x\right)} \]
    5. Step-by-step derivation
      1. log1p-def84.6%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-1 \cdot x\right)} \]
      2. mul-1-neg84.6%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-x}\right) \]
    6. Simplified84.6%

      \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.9%

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

Alternative 8: 62.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.88:\\ \;\;\;\;1 - \log \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{y + -1}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -0.88) (- 1.0 (log (- x))) (- 1.0 (/ x (+ y -1.0)))))
double code(double x, double y) {
	double tmp;
	if (x <= -0.88) {
		tmp = 1.0 - log(-x);
	} else {
		tmp = 1.0 - (x / (y + -1.0));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-0.88d0)) then
        tmp = 1.0d0 - log(-x)
    else
        tmp = 1.0d0 - (x / (y + (-1.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -0.88) {
		tmp = 1.0 - Math.log(-x);
	} else {
		tmp = 1.0 - (x / (y + -1.0));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -0.88:
		tmp = 1.0 - math.log(-x)
	else:
		tmp = 1.0 - (x / (y + -1.0))
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -0.88)
		tmp = Float64(1.0 - log(Float64(-x)));
	else
		tmp = Float64(1.0 - Float64(x / Float64(y + -1.0)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -0.88)
		tmp = 1.0 - log(-x);
	else
		tmp = 1.0 - (x / (y + -1.0));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -0.88], N[(1.0 - N[Log[(-x)], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.88:\\
\;\;\;\;1 - \log \left(-x\right)\\

\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{y + -1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.880000000000000004

    1. Initial program 80.3%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg80.3%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def80.3%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub080.3%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub80.3%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-80.3%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub080.3%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\frac{x}{1 - y}\right)} + \frac{y}{1 - y}\right) \]
      7. +-commutative80.3%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg80.3%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub80.3%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified80.3%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{1 - y}}\right) \]
    5. Step-by-step derivation
      1. neg-mul-182.6%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-\frac{x}{1 - y}}\right) \]
      2. distribute-neg-frac82.6%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    7. Step-by-step derivation
      1. frac-2neg82.6%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-\left(-x\right)}{-\left(1 - y\right)}}\right) \]
      2. div-inv82.6%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\left(-x\right)\right) \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
      3. remove-double-neg82.6%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{x \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
    9. Step-by-step derivation
      1. associate-*r/82.6%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{x \cdot 1}{-\left(1 - y\right)}}\right) \]
      2. *-rgt-identity82.6%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{\color{blue}{x}}{-\left(1 - y\right)}\right) \]
      3. neg-sub082.6%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{0 - \left(1 - y\right)}}\right) \]
      4. associate--r-82.6%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{\left(0 - 1\right) + y}}\right) \]
      5. metadata-eval82.6%

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

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

      \[\leadsto 1 - \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) + \log \left(\frac{1}{y - 1}\right)\right)} \]
    12. Step-by-step derivation
      1. log-rec0.0%

        \[\leadsto 1 - \left(-1 \cdot \log \left(\frac{1}{x}\right) + \color{blue}{\left(-\log \left(y - 1\right)\right)}\right) \]
      2. unsub-neg0.0%

        \[\leadsto 1 - \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) - \log \left(y - 1\right)\right)} \]
      3. mul-1-neg0.0%

        \[\leadsto 1 - \left(\color{blue}{\left(-\log \left(\frac{1}{x}\right)\right)} - \log \left(y - 1\right)\right) \]
      4. log-rec0.0%

        \[\leadsto 1 - \left(\left(-\color{blue}{\left(-\log x\right)}\right) - \log \left(y - 1\right)\right) \]
      5. remove-double-neg0.0%

        \[\leadsto 1 - \left(\color{blue}{\log x} - \log \left(y - 1\right)\right) \]
      6. sub-neg0.0%

        \[\leadsto 1 - \left(\log x - \log \color{blue}{\left(y + \left(-1\right)\right)}\right) \]
      7. metadata-eval0.0%

        \[\leadsto 1 - \left(\log x - \log \left(y + \color{blue}{-1}\right)\right) \]
      8. +-commutative0.0%

        \[\leadsto 1 - \left(\log x - \log \color{blue}{\left(-1 + y\right)}\right) \]
      9. log-div99.0%

        \[\leadsto 1 - \color{blue}{\log \left(\frac{x}{-1 + y}\right)} \]
      10. rem-exp-log0.0%

        \[\leadsto 1 - \log \left(\frac{\color{blue}{e^{\log x}}}{-1 + y}\right) \]
      11. rem-exp-log0.0%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{\color{blue}{e^{\log \left(-1 + y\right)}}}\right) \]
      12. +-commutative0.0%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \color{blue}{\left(y + -1\right)}}}\right) \]
      13. metadata-eval0.0%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \left(y + \color{blue}{\left(-1\right)}\right)}}\right) \]
      14. sub-neg0.0%

        \[\leadsto 1 - \log \left(\frac{e^{\log x}}{e^{\log \color{blue}{\left(y - 1\right)}}}\right) \]
      15. rem-exp-log0.0%

        \[\leadsto 1 - \log \left(\frac{\color{blue}{x}}{e^{\log \left(y - 1\right)}}\right) \]
      16. sub-neg0.0%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \color{blue}{\left(y + \left(-1\right)\right)}}}\right) \]
      17. metadata-eval0.0%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \left(y + \color{blue}{-1}\right)}}\right) \]
      18. +-commutative0.0%

        \[\leadsto 1 - \log \left(\frac{x}{e^{\log \color{blue}{\left(-1 + y\right)}}}\right) \]
      19. rem-exp-log99.0%

        \[\leadsto 1 - \log \left(\frac{x}{\color{blue}{-1 + y}}\right) \]
      20. +-commutative99.0%

        \[\leadsto 1 - \log \left(\frac{x}{\color{blue}{y + -1}}\right) \]
    13. Simplified99.0%

      \[\leadsto 1 - \color{blue}{\log \left(\frac{x}{y + -1}\right)} \]
    14. Taylor expanded in y around 0 66.3%

      \[\leadsto 1 - \color{blue}{\log \left(-1 \cdot x\right)} \]
    15. Step-by-step derivation
      1. neg-mul-166.3%

        \[\leadsto 1 - \log \color{blue}{\left(-x\right)} \]
    16. Simplified66.3%

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

    if -0.880000000000000004 < x

    1. Initial program 70.7%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg70.7%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def70.8%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub070.8%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub70.8%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-70.8%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub070.8%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\frac{x}{1 - y}\right)} + \frac{y}{1 - y}\right) \]
      7. +-commutative70.8%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg70.8%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub70.8%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified70.8%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{1 - y}}\right) \]
    5. Step-by-step derivation
      1. neg-mul-172.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-\frac{x}{1 - y}}\right) \]
      2. distribute-neg-frac72.7%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    7. Step-by-step derivation
      1. frac-2neg72.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-\left(-x\right)}{-\left(1 - y\right)}}\right) \]
      2. div-inv72.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\left(-x\right)\right) \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
      3. remove-double-neg72.7%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{x \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
    9. Step-by-step derivation
      1. associate-*r/72.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{x \cdot 1}{-\left(1 - y\right)}}\right) \]
      2. *-rgt-identity72.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{\color{blue}{x}}{-\left(1 - y\right)}\right) \]
      3. neg-sub072.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{0 - \left(1 - y\right)}}\right) \]
      4. associate--r-72.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{\left(0 - 1\right) + y}}\right) \]
      5. metadata-eval72.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{-1} + y}\right) \]
    10. Simplified72.7%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{x}{-1 + y}}\right) \]
    11. Taylor expanded in x around 0 65.1%

      \[\leadsto 1 - \color{blue}{\frac{x}{y - 1}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.4%

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

Alternative 9: 61.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ 1 - \mathsf{log1p}\left(-x\right) \end{array} \]
(FPCore (x y) :precision binary64 (- 1.0 (log1p (- x))))
double code(double x, double y) {
	return 1.0 - log1p(-x);
}
public static double code(double x, double y) {
	return 1.0 - Math.log1p(-x);
}
def code(x, y):
	return 1.0 - math.log1p(-x)
function code(x, y)
	return Float64(1.0 - log1p(Float64(-x)))
end
code[x_, y_] := N[(1.0 - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 - \mathsf{log1p}\left(-x\right)
\end{array}
Derivation
  1. Initial program 73.3%

    \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
  2. Step-by-step derivation
    1. sub-neg73.3%

      \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
    2. log1p-def73.4%

      \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
    3. neg-sub073.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
    4. div-sub73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
    5. associate--r-73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
    6. neg-sub073.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\frac{x}{1 - y}\right)} + \frac{y}{1 - y}\right) \]
    7. +-commutative73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
    8. sub-neg73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
    9. div-sub73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
  3. Simplified73.4%

    \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
  4. Taylor expanded in y around 0 65.3%

    \[\leadsto 1 - \color{blue}{\log \left(1 + -1 \cdot x\right)} \]
  5. Step-by-step derivation
    1. log1p-def65.3%

      \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-1 \cdot x\right)} \]
    2. mul-1-neg65.3%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-x}\right) \]
  6. Simplified65.3%

    \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-x\right)} \]
  7. Final simplification65.3%

    \[\leadsto 1 - \mathsf{log1p}\left(-x\right) \]

Alternative 10: 42.6% accurate, 15.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.38 \cdot 10^{-5}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 - y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.38e-5) (- 1.0 (/ x y)) (- 1.0 y)))
double code(double x, double y) {
	double tmp;
	if (y <= -1.38e-5) {
		tmp = 1.0 - (x / y);
	} else {
		tmp = 1.0 - y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-1.38d-5)) then
        tmp = 1.0d0 - (x / y)
    else
        tmp = 1.0d0 - y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.38e-5) {
		tmp = 1.0 - (x / y);
	} else {
		tmp = 1.0 - y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.38e-5:
		tmp = 1.0 - (x / y)
	else:
		tmp = 1.0 - y
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.38e-5)
		tmp = Float64(1.0 - Float64(x / y));
	else
		tmp = Float64(1.0 - y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.38e-5)
		tmp = 1.0 - (x / y);
	else
		tmp = 1.0 - y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.38e-5], N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.38 \cdot 10^{-5}:\\
\;\;\;\;1 - \frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;1 - y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.38e-5

    1. Initial program 17.7%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg17.7%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def17.7%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub017.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub17.7%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-17.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub017.7%

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

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg17.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub17.7%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified17.7%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{1 - y}}\right) \]
    5. Step-by-step derivation
      1. neg-mul-127.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-\frac{x}{1 - y}}\right) \]
      2. distribute-neg-frac27.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    6. Simplified27.0%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
    7. Step-by-step derivation
      1. frac-2neg27.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-\left(-x\right)}{-\left(1 - y\right)}}\right) \]
      2. div-inv27.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\left(-x\right)\right) \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
      3. remove-double-neg27.0%

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

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{x \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
    9. Step-by-step derivation
      1. associate-*r/27.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{x \cdot 1}{-\left(1 - y\right)}}\right) \]
      2. *-rgt-identity27.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{\color{blue}{x}}{-\left(1 - y\right)}\right) \]
      3. neg-sub027.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{0 - \left(1 - y\right)}}\right) \]
      4. associate--r-27.0%

        \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{\left(0 - 1\right) + y}}\right) \]
      5. metadata-eval27.0%

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y}} \]

    if -1.38e-5 < y

    1. Initial program 95.5%

      \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
    2. Step-by-step derivation
      1. sub-neg95.5%

        \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
      2. log1p-def95.5%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
      3. neg-sub095.5%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
      4. div-sub95.5%

        \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
      5. associate--r-95.5%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
      6. neg-sub095.5%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\frac{x}{1 - y}\right)} + \frac{y}{1 - y}\right) \]
      7. +-commutative95.5%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
      8. sub-neg95.5%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
      9. div-sub95.5%

        \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
    3. Simplified95.5%

      \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
    4. Taylor expanded in x around 0 61.8%

      \[\leadsto 1 - \color{blue}{\log \left(1 + \frac{y}{1 - y}\right)} \]
    5. Step-by-step derivation
      1. log1p-def61.8%

        \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(\frac{y}{1 - y}\right)} \]
    6. Simplified61.8%

      \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(\frac{y}{1 - y}\right)} \]
    7. Taylor expanded in y around 0 62.1%

      \[\leadsto 1 - \color{blue}{y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.38 \cdot 10^{-5}:\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 - y\\ \end{array} \]

Alternative 11: 44.1% accurate, 15.9× speedup?

\[\begin{array}{l} \\ 1 - \frac{x}{y + -1} \end{array} \]
(FPCore (x y) :precision binary64 (- 1.0 (/ x (+ y -1.0))))
double code(double x, double y) {
	return 1.0 - (x / (y + -1.0));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 - (x / (y + (-1.0d0)))
end function
public static double code(double x, double y) {
	return 1.0 - (x / (y + -1.0));
}
def code(x, y):
	return 1.0 - (x / (y + -1.0))
function code(x, y)
	return Float64(1.0 - Float64(x / Float64(y + -1.0)))
end
function tmp = code(x, y)
	tmp = 1.0 - (x / (y + -1.0));
end
code[x_, y_] := N[(1.0 - N[(x / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 - \frac{x}{y + -1}
\end{array}
Derivation
  1. Initial program 73.3%

    \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
  2. Step-by-step derivation
    1. sub-neg73.3%

      \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
    2. log1p-def73.4%

      \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
    3. neg-sub073.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
    4. div-sub73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
    5. associate--r-73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
    6. neg-sub073.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\frac{x}{1 - y}\right)} + \frac{y}{1 - y}\right) \]
    7. +-commutative73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
    8. sub-neg73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
    9. div-sub73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
  3. Simplified73.4%

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

    \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-1 \cdot \frac{x}{1 - y}}\right) \]
  5. Step-by-step derivation
    1. neg-mul-175.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{-\frac{x}{1 - y}}\right) \]
    2. distribute-neg-frac75.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
  6. Simplified75.4%

    \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-x}{1 - y}}\right) \]
  7. Step-by-step derivation
    1. frac-2neg75.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{-\left(-x\right)}{-\left(1 - y\right)}}\right) \]
    2. div-inv75.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\left(-x\right)\right) \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
    3. remove-double-neg75.4%

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

    \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{x \cdot \frac{1}{-\left(1 - y\right)}}\right) \]
  9. Step-by-step derivation
    1. associate-*r/75.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{x \cdot 1}{-\left(1 - y\right)}}\right) \]
    2. *-rgt-identity75.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\frac{\color{blue}{x}}{-\left(1 - y\right)}\right) \]
    3. neg-sub075.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{0 - \left(1 - y\right)}}\right) \]
    4. associate--r-75.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{\left(0 - 1\right) + y}}\right) \]
    5. metadata-eval75.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\frac{x}{\color{blue}{-1} + y}\right) \]
  10. Simplified75.4%

    \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{x}{-1 + y}}\right) \]
  11. Taylor expanded in x around 0 49.4%

    \[\leadsto 1 - \color{blue}{\frac{x}{y - 1}} \]
  12. Final simplification49.4%

    \[\leadsto 1 - \frac{x}{y + -1} \]

Alternative 12: 40.1% accurate, 37.0× speedup?

\[\begin{array}{l} \\ 1 - y \end{array} \]
(FPCore (x y) :precision binary64 (- 1.0 y))
double code(double x, double y) {
	return 1.0 - y;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 - y
end function
public static double code(double x, double y) {
	return 1.0 - y;
}
def code(x, y):
	return 1.0 - y
function code(x, y)
	return Float64(1.0 - y)
end
function tmp = code(x, y)
	tmp = 1.0 - y;
end
code[x_, y_] := N[(1.0 - y), $MachinePrecision]
\begin{array}{l}

\\
1 - y
\end{array}
Derivation
  1. Initial program 73.3%

    \[1 - \log \left(1 - \frac{x - y}{1 - y}\right) \]
  2. Step-by-step derivation
    1. sub-neg73.3%

      \[\leadsto 1 - \log \color{blue}{\left(1 + \left(-\frac{x - y}{1 - y}\right)\right)} \]
    2. log1p-def73.4%

      \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(-\frac{x - y}{1 - y}\right)} \]
    3. neg-sub073.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{0 - \frac{x - y}{1 - y}}\right) \]
    4. div-sub73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(0 - \color{blue}{\left(\frac{x}{1 - y} - \frac{y}{1 - y}\right)}\right) \]
    5. associate--r-73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(0 - \frac{x}{1 - y}\right) + \frac{y}{1 - y}}\right) \]
    6. neg-sub073.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\left(-\frac{x}{1 - y}\right)} + \frac{y}{1 - y}\right) \]
    7. +-commutative73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} + \left(-\frac{x}{1 - y}\right)}\right) \]
    8. sub-neg73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y}{1 - y} - \frac{x}{1 - y}}\right) \]
    9. div-sub73.4%

      \[\leadsto 1 - \mathsf{log1p}\left(\color{blue}{\frac{y - x}{1 - y}}\right) \]
  3. Simplified73.4%

    \[\leadsto \color{blue}{1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)} \]
  4. Taylor expanded in x around 0 45.0%

    \[\leadsto 1 - \color{blue}{\log \left(1 + \frac{y}{1 - y}\right)} \]
  5. Step-by-step derivation
    1. log1p-def45.0%

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

    \[\leadsto 1 - \color{blue}{\mathsf{log1p}\left(\frac{y}{1 - y}\right)} \]
  7. Taylor expanded in y around 0 45.7%

    \[\leadsto 1 - \color{blue}{y} \]
  8. Final simplification45.7%

    \[\leadsto 1 - y \]

Developer target: 99.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \log \left(\frac{x}{y \cdot y} - \left(\frac{1}{y} - \frac{x}{y}\right)\right)\\ \mathbf{if}\;y < -81284752.61947241:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y < 3.0094271212461764 \cdot 10^{+25}:\\ \;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- 1.0 (log (- (/ x (* y y)) (- (/ 1.0 y) (/ x y)))))))
   (if (< y -81284752.61947241)
     t_0
     (if (< y 3.0094271212461764e+25)
       (log (/ (exp 1.0) (- 1.0 (/ (- x y) (- 1.0 y)))))
       t_0))))
double code(double x, double y) {
	double t_0 = 1.0 - log(((x / (y * y)) - ((1.0 / y) - (x / y))));
	double tmp;
	if (y < -81284752.61947241) {
		tmp = t_0;
	} else if (y < 3.0094271212461764e+25) {
		tmp = log((exp(1.0) / (1.0 - ((x - y) / (1.0 - y)))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 - log(((x / (y * y)) - ((1.0d0 / y) - (x / y))))
    if (y < (-81284752.61947241d0)) then
        tmp = t_0
    else if (y < 3.0094271212461764d+25) then
        tmp = log((exp(1.0d0) / (1.0d0 - ((x - y) / (1.0d0 - y)))))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 1.0 - Math.log(((x / (y * y)) - ((1.0 / y) - (x / y))));
	double tmp;
	if (y < -81284752.61947241) {
		tmp = t_0;
	} else if (y < 3.0094271212461764e+25) {
		tmp = Math.log((Math.exp(1.0) / (1.0 - ((x - y) / (1.0 - y)))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = 1.0 - math.log(((x / (y * y)) - ((1.0 / y) - (x / y))))
	tmp = 0
	if y < -81284752.61947241:
		tmp = t_0
	elif y < 3.0094271212461764e+25:
		tmp = math.log((math.exp(1.0) / (1.0 - ((x - y) / (1.0 - y)))))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(1.0 - log(Float64(Float64(x / Float64(y * y)) - Float64(Float64(1.0 / y) - Float64(x / y)))))
	tmp = 0.0
	if (y < -81284752.61947241)
		tmp = t_0;
	elseif (y < 3.0094271212461764e+25)
		tmp = log(Float64(exp(1.0) / Float64(1.0 - Float64(Float64(x - y) / Float64(1.0 - y)))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 1.0 - log(((x / (y * y)) - ((1.0 / y) - (x / y))));
	tmp = 0.0;
	if (y < -81284752.61947241)
		tmp = t_0;
	elseif (y < 3.0094271212461764e+25)
		tmp = log((exp(1.0) / (1.0 - ((x - y) / (1.0 - y)))));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[Log[N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / y), $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Less[y, -81284752.61947241], t$95$0, If[Less[y, 3.0094271212461764e+25], N[Log[N[(N[Exp[1.0], $MachinePrecision] / N[(1.0 - N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - \log \left(\frac{x}{y \cdot y} - \left(\frac{1}{y} - \frac{x}{y}\right)\right)\\
\mathbf{if}\;y < -81284752.61947241:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y < 3.0094271212461764 \cdot 10^{+25}:\\
\;\;\;\;\log \left(\frac{e^{1}}{1 - \frac{x - y}{1 - y}}\right)\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}

Reproduce

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