
(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:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (x y)
:precision binary64
(if (<= y -2000.0)
(+
1.0
(-
(-
(- (/ -1.0 y) (/ 0.5 (* y y)))
(+ (log (/ -1.0 y)) (/ 0.3333333333333333 (pow y 3.0))))
(log1p (- x))))
(if (<= y 6e+38)
(- 1.0 (log1p (/ (- y x) (- 1.0 y))))
(-
1.0
(log
(* (/ 1.0 y) (exp (+ (log1p x) (fma 0.5 (pow y -2.0) (/ 1.0 y))))))))))
double code(double x, double y) {
double tmp;
if (y <= -2000.0) {
tmp = 1.0 + ((((-1.0 / y) - (0.5 / (y * y))) - (log((-1.0 / y)) + (0.3333333333333333 / pow(y, 3.0)))) - log1p(-x));
} else if (y <= 6e+38) {
tmp = 1.0 - log1p(((y - x) / (1.0 - y)));
} else {
tmp = 1.0 - log(((1.0 / y) * exp((log1p(x) + fma(0.5, pow(y, -2.0), (1.0 / y))))));
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -2000.0) tmp = Float64(1.0 + Float64(Float64(Float64(Float64(-1.0 / y) - Float64(0.5 / Float64(y * y))) - Float64(log(Float64(-1.0 / y)) + Float64(0.3333333333333333 / (y ^ 3.0)))) - log1p(Float64(-x)))); elseif (y <= 6e+38) tmp = Float64(1.0 - log1p(Float64(Float64(y - x) / Float64(1.0 - y)))); else tmp = Float64(1.0 - log(Float64(Float64(1.0 / y) * exp(Float64(log1p(x) + fma(0.5, (y ^ -2.0), Float64(1.0 / y))))))); end return tmp end
code[x_, y_] := If[LessEqual[y, -2000.0], N[(1.0 + N[(N[(N[(N[(-1.0 / y), $MachinePrecision] - N[(0.5 / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision] + N[(0.3333333333333333 / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+38], 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[(N[(1.0 / y), $MachinePrecision] * N[Exp[N[(N[Log[1 + x], $MachinePrecision] + N[(0.5 * N[Power[y, -2.0], $MachinePrecision] + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2000:\\
\;\;\;\;1 + \left(\left(\left(\frac{-1}{y} - \frac{0.5}{y \cdot y}\right) - \left(\log \left(\frac{-1}{y}\right) + \frac{0.3333333333333333}{{y}^{3}}\right)\right) - \mathsf{log1p}\left(-x\right)\right)\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+38}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{1}{y} \cdot e^{\mathsf{log1p}\left(x\right) + \mathsf{fma}\left(0.5, {y}^{-2}, \frac{1}{y}\right)}\right)\\
\end{array}
\end{array}
if y < -2e3Initial program 23.5%
sub-neg23.5%
log1p-def23.5%
distribute-neg-frac23.5%
sub-neg23.5%
distribute-neg-in23.5%
remove-double-neg23.5%
+-commutative23.5%
sub-neg23.5%
Simplified23.5%
flip--23.0%
associate-/r/24.2%
metadata-eval24.2%
+-commutative24.2%
Applied egg-rr24.2%
Taylor expanded in y around -inf 99.4%
log1p-def99.4%
mul-1-neg99.4%
associate-+r+99.4%
associate-*r/99.4%
metadata-eval99.4%
+-commutative99.4%
associate-*r/99.4%
metadata-eval99.4%
unpow299.4%
Simplified99.4%
if -2e3 < y < 6.0000000000000002e38Initial program 100.0%
sub-neg100.0%
log1p-def100.0%
distribute-neg-frac100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
if 6.0000000000000002e38 < y Initial program 43.1%
sub-neg43.1%
log1p-def43.1%
distribute-neg-frac43.1%
sub-neg43.1%
distribute-neg-in43.1%
remove-double-neg43.1%
+-commutative43.1%
sub-neg43.1%
Simplified43.1%
flip--19.7%
associate-/r/19.7%
metadata-eval19.7%
+-commutative19.7%
Applied egg-rr19.7%
Taylor expanded in y around -inf 0.0%
+-commutative0.0%
associate-+r+0.0%
log1p-def0.0%
mul-1-neg0.0%
+-commutative0.0%
associate-*r/0.0%
metadata-eval0.0%
unpow20.0%
Simplified0.0%
+-commutative0.0%
add-log-exp0.0%
sum-log0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
frac-times0.0%
metadata-eval0.0%
metadata-eval0.0%
frac-times0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod50.7%
sqr-neg50.7%
sqrt-unprod98.4%
add-sqr-sqrt98.4%
+-commutative98.4%
Applied egg-rr98.4%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(if (<= y -2000.0)
(+
1.0
(-
(-
(- (/ -1.0 y) (/ 0.5 (* y y)))
(+ (log (/ -1.0 y)) (/ 0.3333333333333333 (pow y 3.0))))
(log1p (- x))))
(if (<= y 5.8e+41)
(- 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 <= -2000.0) {
tmp = 1.0 + ((((-1.0 / y) - (0.5 / (y * y))) - (log((-1.0 / y)) + (0.3333333333333333 / pow(y, 3.0)))) - log1p(-x));
} else if (y <= 5.8e+41) {
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 <= -2000.0) {
tmp = 1.0 + ((((-1.0 / y) - (0.5 / (y * y))) - (Math.log((-1.0 / y)) + (0.3333333333333333 / Math.pow(y, 3.0)))) - Math.log1p(-x));
} else if (y <= 5.8e+41) {
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 <= -2000.0: tmp = 1.0 + ((((-1.0 / y) - (0.5 / (y * y))) - (math.log((-1.0 / y)) + (0.3333333333333333 / math.pow(y, 3.0)))) - math.log1p(-x)) elif y <= 5.8e+41: 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 <= -2000.0) tmp = Float64(1.0 + Float64(Float64(Float64(Float64(-1.0 / y) - Float64(0.5 / Float64(y * y))) - Float64(log(Float64(-1.0 / y)) + Float64(0.3333333333333333 / (y ^ 3.0)))) - log1p(Float64(-x)))); elseif (y <= 5.8e+41) 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, -2000.0], N[(1.0 + N[(N[(N[(N[(-1.0 / y), $MachinePrecision] - N[(0.5 / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision] + N[(0.3333333333333333 / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e+41], 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 -2000:\\
\;\;\;\;1 + \left(\left(\left(\frac{-1}{y} - \frac{0.5}{y \cdot y}\right) - \left(\log \left(\frac{-1}{y}\right) + \frac{0.3333333333333333}{{y}^{3}}\right)\right) - \mathsf{log1p}\left(-x\right)\right)\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+41}:\\
\;\;\;\;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}
if y < -2e3Initial program 23.5%
sub-neg23.5%
log1p-def23.5%
distribute-neg-frac23.5%
sub-neg23.5%
distribute-neg-in23.5%
remove-double-neg23.5%
+-commutative23.5%
sub-neg23.5%
Simplified23.5%
flip--23.0%
associate-/r/24.2%
metadata-eval24.2%
+-commutative24.2%
Applied egg-rr24.2%
Taylor expanded in y around -inf 99.4%
log1p-def99.4%
mul-1-neg99.4%
associate-+r+99.4%
associate-*r/99.4%
metadata-eval99.4%
+-commutative99.4%
associate-*r/99.4%
metadata-eval99.4%
unpow299.4%
Simplified99.4%
if -2e3 < y < 5.79999999999999977e41Initial program 100.0%
sub-neg100.0%
log1p-def100.0%
distribute-neg-frac100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
if 5.79999999999999977e41 < y Initial program 40.8%
sub-neg40.8%
log1p-def40.8%
distribute-neg-frac40.8%
sub-neg40.8%
distribute-neg-in40.8%
remove-double-neg40.8%
+-commutative40.8%
sub-neg40.8%
Simplified40.8%
Taylor expanded in y around inf 98.3%
log-rec98.3%
unsub-neg98.3%
sub-neg98.3%
metadata-eval98.3%
+-commutative98.3%
Simplified98.3%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(if (<= y -16000.0)
(+
1.0
(- (- (- (/ -1.0 y) (/ 0.5 (* y y))) (log1p (- x))) (log (/ -1.0 y))))
(if (<= y 9e+40)
(- 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 <= -16000.0) {
tmp = 1.0 + ((((-1.0 / y) - (0.5 / (y * y))) - log1p(-x)) - log((-1.0 / y)));
} else if (y <= 9e+40) {
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 <= -16000.0) {
tmp = 1.0 + ((((-1.0 / y) - (0.5 / (y * y))) - Math.log1p(-x)) - Math.log((-1.0 / y)));
} else if (y <= 9e+40) {
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 <= -16000.0: tmp = 1.0 + ((((-1.0 / y) - (0.5 / (y * y))) - math.log1p(-x)) - math.log((-1.0 / y))) elif y <= 9e+40: 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 <= -16000.0) tmp = Float64(1.0 + Float64(Float64(Float64(Float64(-1.0 / y) - Float64(0.5 / Float64(y * y))) - log1p(Float64(-x))) - log(Float64(-1.0 / y)))); elseif (y <= 9e+40) 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, -16000.0], N[(1.0 + N[(N[(N[(N[(-1.0 / y), $MachinePrecision] - N[(0.5 / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision] - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+40], 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 -16000:\\
\;\;\;\;1 + \left(\left(\left(\frac{-1}{y} - \frac{0.5}{y \cdot y}\right) - \mathsf{log1p}\left(-x\right)\right) - \log \left(\frac{-1}{y}\right)\right)\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+40}:\\
\;\;\;\;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}
if y < -16000Initial program 23.5%
sub-neg23.5%
log1p-def23.5%
distribute-neg-frac23.5%
sub-neg23.5%
distribute-neg-in23.5%
remove-double-neg23.5%
+-commutative23.5%
sub-neg23.5%
Simplified23.5%
flip--23.0%
associate-/r/24.2%
metadata-eval24.2%
+-commutative24.2%
Applied egg-rr24.2%
Taylor expanded in y around -inf 99.4%
+-commutative99.4%
associate-+r+99.4%
log1p-def99.4%
mul-1-neg99.4%
+-commutative99.4%
associate-*r/99.4%
metadata-eval99.4%
unpow299.4%
Simplified99.4%
if -16000 < y < 9.00000000000000064e40Initial program 100.0%
sub-neg100.0%
log1p-def100.0%
distribute-neg-frac100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
if 9.00000000000000064e40 < y Initial program 40.8%
sub-neg40.8%
log1p-def40.8%
distribute-neg-frac40.8%
sub-neg40.8%
distribute-neg-in40.8%
remove-double-neg40.8%
+-commutative40.8%
sub-neg40.8%
Simplified40.8%
Taylor expanded in y around inf 98.3%
log-rec98.3%
unsub-neg98.3%
sub-neg98.3%
metadata-eval98.3%
+-commutative98.3%
Simplified98.3%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(if (<= y -51000000.0)
(- 1.0 (+ (log1p (- x)) (+ (log (/ -1.0 y)) (/ 1.0 y))))
(if (<= y 7.8e+51)
(- 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 <= -51000000.0) {
tmp = 1.0 - (log1p(-x) + (log((-1.0 / y)) + (1.0 / y)));
} else if (y <= 7.8e+51) {
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 <= -51000000.0) {
tmp = 1.0 - (Math.log1p(-x) + (Math.log((-1.0 / y)) + (1.0 / y)));
} else if (y <= 7.8e+51) {
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 <= -51000000.0: tmp = 1.0 - (math.log1p(-x) + (math.log((-1.0 / y)) + (1.0 / y))) elif y <= 7.8e+51: 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 <= -51000000.0) tmp = Float64(1.0 - Float64(log1p(Float64(-x)) + Float64(log(Float64(-1.0 / y)) + Float64(1.0 / y)))); elseif (y <= 7.8e+51) 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, -51000000.0], N[(1.0 - N[(N[Log[1 + (-x)], $MachinePrecision] + N[(N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision] + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.8e+51], 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 -51000000:\\
\;\;\;\;1 - \left(\mathsf{log1p}\left(-x\right) + \left(\log \left(\frac{-1}{y}\right) + \frac{1}{y}\right)\right)\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+51}:\\
\;\;\;\;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}
if y < -5.1e7Initial program 20.0%
sub-neg20.0%
log1p-def20.0%
distribute-neg-frac20.0%
sub-neg20.0%
distribute-neg-in20.0%
remove-double-neg20.0%
+-commutative20.0%
sub-neg20.0%
Simplified20.0%
flip--19.5%
associate-/r/20.8%
metadata-eval20.8%
+-commutative20.8%
Applied egg-rr20.8%
Taylor expanded in y around -inf 99.4%
log1p-def99.4%
mul-1-neg99.4%
+-commutative99.4%
Simplified99.4%
if -5.1e7 < y < 7.79999999999999968e51Initial program 99.7%
sub-neg99.7%
log1p-def99.8%
distribute-neg-frac99.8%
sub-neg99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
if 7.79999999999999968e51 < y Initial program 40.8%
sub-neg40.8%
log1p-def40.8%
distribute-neg-frac40.8%
sub-neg40.8%
distribute-neg-in40.8%
remove-double-neg40.8%
+-commutative40.8%
sub-neg40.8%
Simplified40.8%
Taylor expanded in y around inf 98.3%
log-rec98.3%
unsub-neg98.3%
sub-neg98.3%
metadata-eval98.3%
+-commutative98.3%
Simplified98.3%
Final simplification99.5%
(FPCore (x y)
:precision binary64
(if (<= y -900000000.0)
(- 1.0 (+ (log1p (- x)) (log (/ -1.0 y))))
(if (<= y 1.46e+40)
(- 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 <= -900000000.0) {
tmp = 1.0 - (log1p(-x) + log((-1.0 / y)));
} else if (y <= 1.46e+40) {
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 <= -900000000.0) {
tmp = 1.0 - (Math.log1p(-x) + Math.log((-1.0 / y)));
} else if (y <= 1.46e+40) {
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 <= -900000000.0: tmp = 1.0 - (math.log1p(-x) + math.log((-1.0 / y))) elif y <= 1.46e+40: 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 <= -900000000.0) tmp = Float64(1.0 - Float64(log1p(Float64(-x)) + log(Float64(-1.0 / y)))); elseif (y <= 1.46e+40) 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, -900000000.0], N[(1.0 - N[(N[Log[1 + (-x)], $MachinePrecision] + N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.46e+40], 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 -900000000:\\
\;\;\;\;1 - \left(\mathsf{log1p}\left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\\
\mathbf{elif}\;y \leq 1.46 \cdot 10^{+40}:\\
\;\;\;\;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}
if y < -9e8Initial program 20.0%
sub-neg20.0%
log1p-def20.0%
distribute-neg-frac20.0%
sub-neg20.0%
distribute-neg-in20.0%
remove-double-neg20.0%
+-commutative20.0%
sub-neg20.0%
Simplified20.0%
Taylor expanded in y around -inf 99.1%
sub-neg99.1%
metadata-eval99.1%
distribute-lft-in99.1%
metadata-eval99.1%
+-commutative99.1%
log1p-def99.1%
mul-1-neg99.1%
Simplified99.1%
if -9e8 < y < 1.46e40Initial program 99.7%
sub-neg99.7%
log1p-def99.8%
distribute-neg-frac99.8%
sub-neg99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
if 1.46e40 < y Initial program 40.8%
sub-neg40.8%
log1p-def40.8%
distribute-neg-frac40.8%
sub-neg40.8%
distribute-neg-in40.8%
remove-double-neg40.8%
+-commutative40.8%
sub-neg40.8%
Simplified40.8%
Taylor expanded in y around inf 98.3%
log-rec98.3%
unsub-neg98.3%
sub-neg98.3%
metadata-eval98.3%
+-commutative98.3%
Simplified98.3%
Final simplification99.4%
(FPCore (x y) :precision binary64 (if (<= (/ (- x y) (- 1.0 y)) 0.999999999996) (- 1.0 (log1p (* (- y x) (/ 1.0 (- 1.0 y))))) (- 1.0 (log (/ -1.0 y)))))
double code(double x, double y) {
double tmp;
if (((x - y) / (1.0 - y)) <= 0.999999999996) {
tmp = 1.0 - log1p(((y - x) * (1.0 / (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)) <= 0.999999999996) {
tmp = 1.0 - Math.log1p(((y - x) * (1.0 / (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)) <= 0.999999999996: tmp = 1.0 - math.log1p(((y - x) * (1.0 / (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)) <= 0.999999999996) tmp = Float64(1.0 - log1p(Float64(Float64(y - x) * Float64(1.0 / 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], 0.999999999996], N[(1.0 - N[Log[1 + N[(N[(y - x), $MachinePrecision] * N[(1.0 / N[(1.0 - y), $MachinePrecision]), $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 0.999999999996:\\
\;\;\;\;1 - \mathsf{log1p}\left(\left(y - x\right) \cdot \frac{1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 x y) (-.f64 1 y)) < 0.999999999995999977Initial program 99.1%
sub-neg99.1%
log1p-def99.1%
distribute-neg-frac99.1%
sub-neg99.1%
distribute-neg-in99.1%
remove-double-neg99.1%
+-commutative99.1%
sub-neg99.1%
Simplified99.1%
clear-num99.1%
associate-/r/99.1%
Applied egg-rr99.1%
if 0.999999999995999977 < (/.f64 (-.f64 x y) (-.f64 1 y)) Initial program 3.8%
sub-neg3.8%
log1p-def3.8%
distribute-neg-frac3.8%
sub-neg3.8%
distribute-neg-in3.8%
remove-double-neg3.8%
+-commutative3.8%
sub-neg3.8%
Simplified3.8%
Taylor expanded in y around -inf 80.7%
sub-neg80.7%
metadata-eval80.7%
distribute-lft-in80.7%
metadata-eval80.7%
+-commutative80.7%
log1p-def80.7%
mul-1-neg80.7%
Simplified80.7%
Taylor expanded in x around 0 66.5%
Final simplification89.1%
(FPCore (x y) :precision binary64 (if (<= (/ (- x y) (- 1.0 y)) 0.999999999996) (- 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)) <= 0.999999999996) {
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)) <= 0.999999999996) {
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)) <= 0.999999999996: 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)) <= 0.999999999996) 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], 0.999999999996], 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 0.999999999996:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 x y) (-.f64 1 y)) < 0.999999999995999977Initial program 99.1%
sub-neg99.1%
log1p-def99.1%
distribute-neg-frac99.1%
sub-neg99.1%
distribute-neg-in99.1%
remove-double-neg99.1%
+-commutative99.1%
sub-neg99.1%
Simplified99.1%
if 0.999999999995999977 < (/.f64 (-.f64 x y) (-.f64 1 y)) Initial program 3.8%
sub-neg3.8%
log1p-def3.8%
distribute-neg-frac3.8%
sub-neg3.8%
distribute-neg-in3.8%
remove-double-neg3.8%
+-commutative3.8%
sub-neg3.8%
Simplified3.8%
Taylor expanded in y around -inf 80.7%
sub-neg80.7%
metadata-eval80.7%
distribute-lft-in80.7%
metadata-eval80.7%
+-commutative80.7%
log1p-def80.7%
mul-1-neg80.7%
Simplified80.7%
Taylor expanded in x around 0 66.5%
Final simplification89.0%
(FPCore (x y)
:precision binary64
(if (<= y -7.8)
(- 1.0 (log (/ -1.0 y)))
(if (<= y 1.0)
(- 1.0 (+ y (log1p (- x))))
(- 1.0 (log1p (+ -1.0 (/ x y)))))))
double code(double x, double y) {
double tmp;
if (y <= -7.8) {
tmp = 1.0 - log((-1.0 / y));
} else if (y <= 1.0) {
tmp = 1.0 - (y + log1p(-x));
} else {
tmp = 1.0 - log1p((-1.0 + (x / y)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -7.8) {
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.log1p((-1.0 + (x / y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.8: tmp = 1.0 - math.log((-1.0 / y)) elif y <= 1.0: tmp = 1.0 - (y + math.log1p(-x)) else: tmp = 1.0 - math.log1p((-1.0 + (x / y))) return tmp
function code(x, y) tmp = 0.0 if (y <= -7.8) 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 - log1p(Float64(-1.0 + Float64(x / y)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -7.8], 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[1 + N[(-1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 - \left(y + \mathsf{log1p}\left(-x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(-1 + \frac{x}{y}\right)\\
\end{array}
\end{array}
if y < -7.79999999999999982Initial program 23.5%
sub-neg23.5%
log1p-def23.5%
distribute-neg-frac23.5%
sub-neg23.5%
distribute-neg-in23.5%
remove-double-neg23.5%
+-commutative23.5%
sub-neg23.5%
Simplified23.5%
Taylor expanded in y around -inf 97.0%
sub-neg97.0%
metadata-eval97.0%
distribute-lft-in97.0%
metadata-eval97.0%
+-commutative97.0%
log1p-def97.0%
mul-1-neg97.0%
Simplified97.0%
Taylor expanded in x around 0 66.6%
if -7.79999999999999982 < y < 1Initial program 100.0%
sub-neg100.0%
log1p-def100.0%
distribute-neg-frac100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
flip--100.0%
associate-/r/100.0%
metadata-eval100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 98.5%
log1p-def98.5%
mul-1-neg98.5%
Simplified98.5%
if 1 < y Initial program 50.7%
sub-neg50.7%
log1p-def50.7%
distribute-neg-frac50.7%
sub-neg50.7%
distribute-neg-in50.7%
remove-double-neg50.7%
+-commutative50.7%
sub-neg50.7%
Simplified50.7%
clear-num50.8%
associate-/r/52.2%
Applied egg-rr52.2%
Taylor expanded in y around inf 50.5%
Taylor expanded in y around 0 49.1%
Final simplification82.5%
(FPCore (x y) :precision binary64 (if (<= y -19.0) (- 1.0 (log (/ -1.0 y))) (if (<= y 1.0) (- 1.0 (+ y (log1p (- x)))) (- 1.0 (log1p (/ x y))))))
double code(double x, double y) {
double tmp;
if (y <= -19.0) {
tmp = 1.0 - log((-1.0 / y));
} else if (y <= 1.0) {
tmp = 1.0 - (y + log1p(-x));
} else {
tmp = 1.0 - log1p((x / y));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -19.0) {
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.log1p((x / y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -19.0: tmp = 1.0 - math.log((-1.0 / y)) elif y <= 1.0: tmp = 1.0 - (y + math.log1p(-x)) else: tmp = 1.0 - math.log1p((x / y)) return tmp
function code(x, y) tmp = 0.0 if (y <= -19.0) 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 - log1p(Float64(x / y))); end return tmp end
code[x_, y_] := If[LessEqual[y, -19.0], 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[1 + N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -19:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 - \left(y + \mathsf{log1p}\left(-x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x}{y}\right)\\
\end{array}
\end{array}
if y < -19Initial program 23.5%
sub-neg23.5%
log1p-def23.5%
distribute-neg-frac23.5%
sub-neg23.5%
distribute-neg-in23.5%
remove-double-neg23.5%
+-commutative23.5%
sub-neg23.5%
Simplified23.5%
Taylor expanded in y around -inf 97.0%
sub-neg97.0%
metadata-eval97.0%
distribute-lft-in97.0%
metadata-eval97.0%
+-commutative97.0%
log1p-def97.0%
mul-1-neg97.0%
Simplified97.0%
Taylor expanded in x around 0 66.6%
if -19 < y < 1Initial program 100.0%
sub-neg100.0%
log1p-def100.0%
distribute-neg-frac100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
flip--100.0%
associate-/r/100.0%
metadata-eval100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 98.5%
log1p-def98.5%
mul-1-neg98.5%
Simplified98.5%
if 1 < y Initial program 50.7%
sub-neg50.7%
log1p-def50.7%
distribute-neg-frac50.7%
sub-neg50.7%
distribute-neg-in50.7%
remove-double-neg50.7%
+-commutative50.7%
sub-neg50.7%
Simplified50.7%
Taylor expanded in x around inf 50.1%
neg-mul-150.1%
distribute-neg-frac50.1%
Simplified50.1%
Taylor expanded in y around inf 48.5%
Final simplification82.4%
(FPCore (x y) :precision binary64 (if (<= y -820000000.0) (- 1.0 (log (/ -1.0 y))) (- 1.0 (log1p (/ (- x) (- 1.0 y))))))
double code(double x, double y) {
double tmp;
if (y <= -820000000.0) {
tmp = 1.0 - log((-1.0 / y));
} else {
tmp = 1.0 - log1p((-x / (1.0 - y)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -820000000.0) {
tmp = 1.0 - Math.log((-1.0 / y));
} else {
tmp = 1.0 - Math.log1p((-x / (1.0 - y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -820000000.0: tmp = 1.0 - math.log((-1.0 / y)) else: tmp = 1.0 - math.log1p((-x / (1.0 - y))) return tmp
function code(x, y) tmp = 0.0 if (y <= -820000000.0) tmp = Float64(1.0 - log(Float64(-1.0 / y))); else tmp = Float64(1.0 - log1p(Float64(Float64(-x) / Float64(1.0 - y)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -820000000.0], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[1 + N[((-x) / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -820000000:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{-x}{1 - y}\right)\\
\end{array}
\end{array}
if y < -8.2e8Initial program 20.0%
sub-neg20.0%
log1p-def20.0%
distribute-neg-frac20.0%
sub-neg20.0%
distribute-neg-in20.0%
remove-double-neg20.0%
+-commutative20.0%
sub-neg20.0%
Simplified20.0%
Taylor expanded in y around -inf 99.1%
sub-neg99.1%
metadata-eval99.1%
distribute-lft-in99.1%
metadata-eval99.1%
+-commutative99.1%
log1p-def99.1%
mul-1-neg99.1%
Simplified99.1%
Taylor expanded in x around 0 68.7%
if -8.2e8 < y Initial program 91.5%
sub-neg91.5%
log1p-def91.5%
distribute-neg-frac91.5%
sub-neg91.5%
distribute-neg-in91.5%
remove-double-neg91.5%
+-commutative91.5%
sub-neg91.5%
Simplified91.5%
Taylor expanded in x around inf 89.3%
neg-mul-189.3%
distribute-neg-frac89.3%
Simplified89.3%
Final simplification83.0%
(FPCore (x y) :precision binary64 (if (<= y -44.0) (- 1.0 (log (/ -1.0 y))) (if (<= y 1.0) (- 1.0 (log1p (- x))) (- 1.0 (log1p (/ x y))))))
double code(double x, double y) {
double tmp;
if (y <= -44.0) {
tmp = 1.0 - log((-1.0 / y));
} else if (y <= 1.0) {
tmp = 1.0 - log1p(-x);
} else {
tmp = 1.0 - log1p((x / y));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -44.0) {
tmp = 1.0 - Math.log((-1.0 / y));
} else if (y <= 1.0) {
tmp = 1.0 - Math.log1p(-x);
} else {
tmp = 1.0 - Math.log1p((x / y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -44.0: tmp = 1.0 - math.log((-1.0 / y)) elif y <= 1.0: tmp = 1.0 - math.log1p(-x) else: tmp = 1.0 - math.log1p((x / y)) return tmp
function code(x, y) tmp = 0.0 if (y <= -44.0) 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 - log1p(Float64(x / y))); end return tmp end
code[x_, y_] := If[LessEqual[y, -44.0], 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[1 + N[(x / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -44:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x}{y}\right)\\
\end{array}
\end{array}
if y < -44Initial program 23.5%
sub-neg23.5%
log1p-def23.5%
distribute-neg-frac23.5%
sub-neg23.5%
distribute-neg-in23.5%
remove-double-neg23.5%
+-commutative23.5%
sub-neg23.5%
Simplified23.5%
Taylor expanded in y around -inf 97.0%
sub-neg97.0%
metadata-eval97.0%
distribute-lft-in97.0%
metadata-eval97.0%
+-commutative97.0%
log1p-def97.0%
mul-1-neg97.0%
Simplified97.0%
Taylor expanded in x around 0 66.6%
if -44 < y < 1Initial program 100.0%
sub-neg100.0%
log1p-def100.0%
distribute-neg-frac100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 97.2%
log1p-def97.2%
mul-1-neg97.2%
Simplified97.2%
if 1 < y Initial program 50.7%
sub-neg50.7%
log1p-def50.7%
distribute-neg-frac50.7%
sub-neg50.7%
distribute-neg-in50.7%
remove-double-neg50.7%
+-commutative50.7%
sub-neg50.7%
Simplified50.7%
Taylor expanded in x around inf 50.1%
neg-mul-150.1%
distribute-neg-frac50.1%
Simplified50.1%
Taylor expanded in y around inf 48.5%
Final simplification81.7%
(FPCore (x y) :precision binary64 (if (<= y -215.0) (- 1.0 (log (/ -1.0 y))) (- 1.0 (log1p (- x)))))
double code(double x, double y) {
double tmp;
if (y <= -215.0) {
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 <= -215.0) {
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 <= -215.0: 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 <= -215.0) 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, -215.0], 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 -215:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\
\end{array}
\end{array}
if y < -215Initial program 23.5%
sub-neg23.5%
log1p-def23.5%
distribute-neg-frac23.5%
sub-neg23.5%
distribute-neg-in23.5%
remove-double-neg23.5%
+-commutative23.5%
sub-neg23.5%
Simplified23.5%
Taylor expanded in y around -inf 97.0%
sub-neg97.0%
metadata-eval97.0%
distribute-lft-in97.0%
metadata-eval97.0%
+-commutative97.0%
log1p-def97.0%
mul-1-neg97.0%
Simplified97.0%
Taylor expanded in x around 0 66.6%
if -215 < y Initial program 91.5%
sub-neg91.5%
log1p-def91.5%
distribute-neg-frac91.5%
sub-neg91.5%
distribute-neg-in91.5%
remove-double-neg91.5%
+-commutative91.5%
sub-neg91.5%
Simplified91.5%
Taylor expanded in y around 0 80.4%
log1p-def80.4%
mul-1-neg80.4%
Simplified80.4%
Final simplification76.0%
(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}
Initial program 69.7%
sub-neg69.7%
log1p-def69.7%
distribute-neg-frac69.7%
sub-neg69.7%
distribute-neg-in69.7%
remove-double-neg69.7%
+-commutative69.7%
sub-neg69.7%
Simplified69.7%
Taylor expanded in y around 0 58.7%
log1p-def58.8%
mul-1-neg58.8%
Simplified58.8%
Final simplification58.8%
(FPCore (x y) :precision binary64 (+ 1.0 x))
double code(double x, double y) {
return 1.0 + x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + x
end function
public static double code(double x, double y) {
return 1.0 + x;
}
def code(x, y): return 1.0 + x
function code(x, y) return Float64(1.0 + x) end
function tmp = code(x, y) tmp = 1.0 + x; end
code[x_, y_] := N[(1.0 + x), $MachinePrecision]
\begin{array}{l}
\\
1 + x
\end{array}
Initial program 69.7%
sub-neg69.7%
log1p-def69.7%
distribute-neg-frac69.7%
sub-neg69.7%
distribute-neg-in69.7%
remove-double-neg69.7%
+-commutative69.7%
sub-neg69.7%
Simplified69.7%
Taylor expanded in y around 0 58.7%
log1p-def58.8%
mul-1-neg58.8%
Simplified58.8%
Taylor expanded in x around 0 39.7%
Final simplification39.7%
(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}
herbie shell --seed 2023290
(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))))))