
(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
(let* ((t_0 (/ (- 1.0 x) (+ x -1.0))))
(if (<= y -1750.0)
(-
1.0
(+
(log1p (- x))
(+
(- (log (/ -1.0 y)) (/ (- 1.0 x) (* y (+ x -1.0))))
(fma
-0.16666666666666666
(/ (fma -6.0 t_0 (fma 2.0 t_0 (* t_0 6.0))) (pow y 3.0))
(/ 0.5 (pow y 2.0))))))
(if (<= y 9e+127)
(- 1.0 (log1p (* (/ 1.0 (- 1.0 y)) (- y x))))
(+ 1.0 (- (log y) (log (+ x -1.0))))))))
double code(double x, double y) {
double t_0 = (1.0 - x) / (x + -1.0);
double tmp;
if (y <= -1750.0) {
tmp = 1.0 - (log1p(-x) + ((log((-1.0 / y)) - ((1.0 - x) / (y * (x + -1.0)))) + fma(-0.16666666666666666, (fma(-6.0, t_0, fma(2.0, t_0, (t_0 * 6.0))) / pow(y, 3.0)), (0.5 / pow(y, 2.0)))));
} else if (y <= 9e+127) {
tmp = 1.0 - log1p(((1.0 / (1.0 - y)) * (y - x)));
} else {
tmp = 1.0 + (log(y) - log((x + -1.0)));
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(1.0 - x) / Float64(x + -1.0)) tmp = 0.0 if (y <= -1750.0) tmp = Float64(1.0 - Float64(log1p(Float64(-x)) + Float64(Float64(log(Float64(-1.0 / y)) - Float64(Float64(1.0 - x) / Float64(y * Float64(x + -1.0)))) + fma(-0.16666666666666666, Float64(fma(-6.0, t_0, fma(2.0, t_0, Float64(t_0 * 6.0))) / (y ^ 3.0)), Float64(0.5 / (y ^ 2.0)))))); elseif (y <= 9e+127) tmp = Float64(1.0 - log1p(Float64(Float64(1.0 / Float64(1.0 - y)) * Float64(y - x)))); else tmp = Float64(1.0 + Float64(log(y) - log(Float64(x + -1.0)))); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1750.0], N[(1.0 - N[(N[Log[1 + (-x)], $MachinePrecision] + N[(N[(N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision] - N[(N[(1.0 - x), $MachinePrecision] / N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(N[(-6.0 * t$95$0 + N[(2.0 * t$95$0 + N[(t$95$0 * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] + N[(0.5 / N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+127], N[(1.0 - N[Log[1 + N[(N[(1.0 / N[(1.0 - y), $MachinePrecision]), $MachinePrecision] * N[(y - x), $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}
t_0 := \frac{1 - x}{x + -1}\\
\mathbf{if}\;y \leq -1750:\\
\;\;\;\;1 - \left(\mathsf{log1p}\left(-x\right) + \left(\left(\log \left(\frac{-1}{y}\right) - \frac{1 - x}{y \cdot \left(x + -1\right)}\right) + \mathsf{fma}\left(-0.16666666666666666, \frac{\mathsf{fma}\left(-6, t_0, \mathsf{fma}\left(2, t_0, t_0 \cdot 6\right)\right)}{{y}^{3}}, \frac{0.5}{{y}^{2}}\right)\right)\right)\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+127}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{1}{1 - y} \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\
\end{array}
\end{array}
if y < -1750Initial program 22.9%
sub-neg22.9%
log1p-def22.9%
distribute-neg-frac22.9%
sub-neg22.9%
distribute-neg-in22.9%
remove-double-neg22.9%
+-commutative22.9%
sub-neg22.9%
Simplified22.9%
Taylor expanded in y around -inf 76.1%
Simplified99.5%
if -1750 < y < 9.00000000000000068e127Initial 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%
clear-num100.0%
associate-/r/100.0%
Applied egg-rr100.0%
if 9.00000000000000068e127 < y Initial program 22.4%
sub-neg22.4%
log1p-def22.4%
distribute-neg-frac22.4%
sub-neg22.4%
distribute-neg-in22.4%
remove-double-neg22.4%
+-commutative22.4%
sub-neg22.4%
Simplified22.4%
Taylor expanded in y around inf 98.1%
log-rec98.1%
unsub-neg98.1%
sub-neg98.1%
metadata-eval98.1%
+-commutative98.1%
Simplified98.1%
Final simplification99.7%
(FPCore (x y)
:precision binary64
(if (<= y -15500.0)
(-
1.0
(+
(- (log (/ -1.0 y)) (/ (- 1.0 x) (* y (+ x -1.0))))
(+ (log1p (- x)) (/ 0.5 (pow y 2.0)))))
(if (<= y 9e+127)
(- 1.0 (log1p (* (/ 1.0 (- 1.0 y)) (- y x))))
(+ 1.0 (- (log y) (log (+ x -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -15500.0) {
tmp = 1.0 - ((log((-1.0 / y)) - ((1.0 - x) / (y * (x + -1.0)))) + (log1p(-x) + (0.5 / pow(y, 2.0))));
} else if (y <= 9e+127) {
tmp = 1.0 - log1p(((1.0 / (1.0 - y)) * (y - x)));
} else {
tmp = 1.0 + (log(y) - log((x + -1.0)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -15500.0) {
tmp = 1.0 - ((Math.log((-1.0 / y)) - ((1.0 - x) / (y * (x + -1.0)))) + (Math.log1p(-x) + (0.5 / Math.pow(y, 2.0))));
} else if (y <= 9e+127) {
tmp = 1.0 - Math.log1p(((1.0 / (1.0 - y)) * (y - x)));
} else {
tmp = 1.0 + (Math.log(y) - Math.log((x + -1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -15500.0: tmp = 1.0 - ((math.log((-1.0 / y)) - ((1.0 - x) / (y * (x + -1.0)))) + (math.log1p(-x) + (0.5 / math.pow(y, 2.0)))) elif y <= 9e+127: tmp = 1.0 - math.log1p(((1.0 / (1.0 - y)) * (y - x))) else: tmp = 1.0 + (math.log(y) - math.log((x + -1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= -15500.0) tmp = Float64(1.0 - Float64(Float64(log(Float64(-1.0 / y)) - Float64(Float64(1.0 - x) / Float64(y * Float64(x + -1.0)))) + Float64(log1p(Float64(-x)) + Float64(0.5 / (y ^ 2.0))))); elseif (y <= 9e+127) tmp = Float64(1.0 - log1p(Float64(Float64(1.0 / Float64(1.0 - y)) * Float64(y - x)))); else tmp = Float64(1.0 + Float64(log(y) - log(Float64(x + -1.0)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -15500.0], N[(1.0 - N[(N[(N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision] - N[(N[(1.0 - x), $MachinePrecision] / N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Log[1 + (-x)], $MachinePrecision] + N[(0.5 / N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+127], N[(1.0 - N[Log[1 + N[(N[(1.0 / N[(1.0 - y), $MachinePrecision]), $MachinePrecision] * N[(y - x), $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 -15500:\\
\;\;\;\;1 - \left(\left(\log \left(\frac{-1}{y}\right) - \frac{1 - x}{y \cdot \left(x + -1\right)}\right) + \left(\mathsf{log1p}\left(-x\right) + \frac{0.5}{{y}^{2}}\right)\right)\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+127}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{1}{1 - y} \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\
\end{array}
\end{array}
if y < -15500Initial program 22.1%
sub-neg22.1%
log1p-def22.1%
distribute-neg-frac22.1%
sub-neg22.1%
distribute-neg-in22.1%
remove-double-neg22.1%
+-commutative22.1%
sub-neg22.1%
Simplified22.1%
Taylor expanded in y around -inf 83.0%
Simplified99.5%
if -15500 < y < 9.00000000000000068e127Initial program 99.9%
sub-neg99.9%
log1p-def99.9%
distribute-neg-frac99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
clear-num99.9%
associate-/r/99.9%
Applied egg-rr99.9%
if 9.00000000000000068e127 < y Initial program 22.4%
sub-neg22.4%
log1p-def22.4%
distribute-neg-frac22.4%
sub-neg22.4%
distribute-neg-in22.4%
remove-double-neg22.4%
+-commutative22.4%
sub-neg22.4%
Simplified22.4%
Taylor expanded in y around inf 98.1%
log-rec98.1%
unsub-neg98.1%
sub-neg98.1%
metadata-eval98.1%
+-commutative98.1%
Simplified98.1%
Final simplification99.7%
(FPCore (x y)
:precision binary64
(if (<= y -450000.0)
(-
1.0
(+ (log1p (- x)) (- (log (/ -1.0 y)) (/ (- 1.0 x) (* y (+ x -1.0))))))
(if (<= y 9e+127)
(- 1.0 (log1p (* (/ 1.0 (- 1.0 y)) (- y x))))
(+ 1.0 (- (log y) (log (+ x -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -450000.0) {
tmp = 1.0 - (log1p(-x) + (log((-1.0 / y)) - ((1.0 - x) / (y * (x + -1.0)))));
} else if (y <= 9e+127) {
tmp = 1.0 - log1p(((1.0 / (1.0 - y)) * (y - x)));
} else {
tmp = 1.0 + (log(y) - log((x + -1.0)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -450000.0) {
tmp = 1.0 - (Math.log1p(-x) + (Math.log((-1.0 / y)) - ((1.0 - x) / (y * (x + -1.0)))));
} else if (y <= 9e+127) {
tmp = 1.0 - Math.log1p(((1.0 / (1.0 - y)) * (y - x)));
} else {
tmp = 1.0 + (Math.log(y) - Math.log((x + -1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -450000.0: tmp = 1.0 - (math.log1p(-x) + (math.log((-1.0 / y)) - ((1.0 - x) / (y * (x + -1.0))))) elif y <= 9e+127: tmp = 1.0 - math.log1p(((1.0 / (1.0 - y)) * (y - x))) else: tmp = 1.0 + (math.log(y) - math.log((x + -1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= -450000.0) tmp = Float64(1.0 - Float64(log1p(Float64(-x)) + Float64(log(Float64(-1.0 / y)) - Float64(Float64(1.0 - x) / Float64(y * Float64(x + -1.0)))))); elseif (y <= 9e+127) tmp = Float64(1.0 - log1p(Float64(Float64(1.0 / Float64(1.0 - y)) * Float64(y - x)))); else tmp = Float64(1.0 + Float64(log(y) - log(Float64(x + -1.0)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -450000.0], N[(1.0 - N[(N[Log[1 + (-x)], $MachinePrecision] + N[(N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision] - N[(N[(1.0 - x), $MachinePrecision] / N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+127], N[(1.0 - N[Log[1 + N[(N[(1.0 / N[(1.0 - y), $MachinePrecision]), $MachinePrecision] * N[(y - x), $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 -450000:\\
\;\;\;\;1 - \left(\mathsf{log1p}\left(-x\right) + \left(\log \left(\frac{-1}{y}\right) - \frac{1 - x}{y \cdot \left(x + -1\right)}\right)\right)\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+127}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{1}{1 - y} \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\
\end{array}
\end{array}
if y < -4.5e5Initial program 21.4%
sub-neg21.4%
log1p-def21.4%
distribute-neg-frac21.4%
sub-neg21.4%
distribute-neg-in21.4%
remove-double-neg21.4%
+-commutative21.4%
sub-neg21.4%
Simplified21.4%
Taylor expanded in y around -inf 99.5%
sub-neg99.5%
metadata-eval99.5%
distribute-lft-in99.5%
metadata-eval99.5%
+-commutative99.5%
log1p-def99.5%
mul-1-neg99.5%
mul-1-neg99.5%
unsub-neg99.5%
div-sub99.5%
associate-/l/99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
if -4.5e5 < y < 9.00000000000000068e127Initial program 99.8%
sub-neg99.8%
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%
clear-num99.8%
associate-/r/99.8%
Applied egg-rr99.8%
if 9.00000000000000068e127 < y Initial program 22.4%
sub-neg22.4%
log1p-def22.4%
distribute-neg-frac22.4%
sub-neg22.4%
distribute-neg-in22.4%
remove-double-neg22.4%
+-commutative22.4%
sub-neg22.4%
Simplified22.4%
Taylor expanded in y around inf 98.1%
log-rec98.1%
unsub-neg98.1%
sub-neg98.1%
metadata-eval98.1%
+-commutative98.1%
Simplified98.1%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(if (<= y -960000000.0)
(- (- 1.0 (log1p (- x))) (log (/ -1.0 y)))
(if (<= y 9e+127)
(- 1.0 (log1p (* (/ 1.0 (- 1.0 y)) (- y x))))
(+ 1.0 (- (log y) (log (+ x -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -960000000.0) {
tmp = (1.0 - log1p(-x)) - log((-1.0 / y));
} else if (y <= 9e+127) {
tmp = 1.0 - log1p(((1.0 / (1.0 - y)) * (y - x)));
} else {
tmp = 1.0 + (log(y) - log((x + -1.0)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -960000000.0) {
tmp = (1.0 - Math.log1p(-x)) - Math.log((-1.0 / y));
} else if (y <= 9e+127) {
tmp = 1.0 - Math.log1p(((1.0 / (1.0 - y)) * (y - x)));
} else {
tmp = 1.0 + (Math.log(y) - Math.log((x + -1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -960000000.0: tmp = (1.0 - math.log1p(-x)) - math.log((-1.0 / y)) elif y <= 9e+127: tmp = 1.0 - math.log1p(((1.0 / (1.0 - y)) * (y - x))) else: tmp = 1.0 + (math.log(y) - math.log((x + -1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= -960000000.0) tmp = Float64(Float64(1.0 - log1p(Float64(-x))) - log(Float64(-1.0 / y))); elseif (y <= 9e+127) tmp = Float64(1.0 - log1p(Float64(Float64(1.0 / Float64(1.0 - y)) * Float64(y - x)))); else tmp = Float64(1.0 + Float64(log(y) - log(Float64(x + -1.0)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -960000000.0], N[(N[(1.0 - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision] - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+127], N[(1.0 - N[Log[1 + N[(N[(1.0 / N[(1.0 - y), $MachinePrecision]), $MachinePrecision] * N[(y - x), $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 -960000000:\\
\;\;\;\;\left(1 - \mathsf{log1p}\left(-x\right)\right) - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+127}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{1}{1 - y} \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\
\end{array}
\end{array}
if y < -9.6e8Initial program 21.4%
sub-neg21.4%
log1p-def21.4%
distribute-neg-frac21.4%
sub-neg21.4%
distribute-neg-in21.4%
remove-double-neg21.4%
+-commutative21.4%
sub-neg21.4%
Simplified21.4%
Taylor expanded in y around -inf 99.4%
associate--r+99.4%
sub-neg99.4%
metadata-eval99.4%
distribute-lft-in99.4%
metadata-eval99.4%
+-commutative99.4%
log1p-def99.4%
mul-1-neg99.4%
Simplified99.4%
if -9.6e8 < y < 9.00000000000000068e127Initial program 99.8%
sub-neg99.8%
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%
clear-num99.8%
associate-/r/99.8%
Applied egg-rr99.8%
if 9.00000000000000068e127 < y Initial program 22.4%
sub-neg22.4%
log1p-def22.4%
distribute-neg-frac22.4%
sub-neg22.4%
distribute-neg-in22.4%
remove-double-neg22.4%
+-commutative22.4%
sub-neg22.4%
Simplified22.4%
Taylor expanded in y around inf 98.1%
log-rec98.1%
unsub-neg98.1%
sub-neg98.1%
metadata-eval98.1%
+-commutative98.1%
Simplified98.1%
Final simplification99.6%
(FPCore (x y) :precision binary64 (if (<= (/ (- x y) (- 1.0 y)) 0.9999999999995) (- 1.0 (log1p (/ (- y x) (- 1.0 y)))) (+ 1.0 (- (/ -1.0 y) (log (/ -1.0 y))))))
double code(double x, double y) {
double tmp;
if (((x - y) / (1.0 - y)) <= 0.9999999999995) {
tmp = 1.0 - log1p(((y - x) / (1.0 - y)));
} else {
tmp = 1.0 + ((-1.0 / y) - log((-1.0 / y)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (((x - y) / (1.0 - y)) <= 0.9999999999995) {
tmp = 1.0 - Math.log1p(((y - x) / (1.0 - y)));
} else {
tmp = 1.0 + ((-1.0 / y) - Math.log((-1.0 / y)));
}
return tmp;
}
def code(x, y): tmp = 0 if ((x - y) / (1.0 - y)) <= 0.9999999999995: tmp = 1.0 - math.log1p(((y - x) / (1.0 - y))) else: tmp = 1.0 + ((-1.0 / y) - math.log((-1.0 / y))) return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(x - y) / Float64(1.0 - y)) <= 0.9999999999995) tmp = Float64(1.0 - log1p(Float64(Float64(y - x) / Float64(1.0 - y)))); else tmp = Float64(1.0 + Float64(Float64(-1.0 / y) - 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.9999999999995], N[(1.0 - N[Log[1 + N[(N[(y - x), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(-1.0 / y), $MachinePrecision] - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{1 - y} \leq 0.9999999999995:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\frac{-1}{y} - \log \left(\frac{-1}{y}\right)\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 x y) (-.f64 1 y)) < 0.99999999999949996Initial program 99.4%
sub-neg99.4%
log1p-def99.4%
distribute-neg-frac99.4%
sub-neg99.4%
distribute-neg-in99.4%
remove-double-neg99.4%
+-commutative99.4%
sub-neg99.4%
Simplified99.4%
if 0.99999999999949996 < (/.f64 (-.f64 x y) (-.f64 1 y)) Initial program 4.6%
sub-neg4.6%
log1p-def4.6%
distribute-neg-frac4.6%
sub-neg4.6%
distribute-neg-in4.6%
remove-double-neg4.6%
+-commutative4.6%
sub-neg4.6%
Simplified4.6%
Taylor expanded in x around 0 4.1%
log1p-def4.1%
Simplified4.1%
Taylor expanded in y around inf 0.0%
associate-+r+0.0%
log-rec0.0%
sub-neg0.0%
log-div71.5%
+-commutative71.5%
Simplified71.5%
Final simplification90.8%
(FPCore (x y)
:precision binary64
(if (<= y -1550000000000.0)
(- 1.0 (log (/ -1.0 y)))
(if (<= y 0.02)
(- 1.0 (log1p (/ (- y x) (- 1.0 y))))
(- 1.0 (log (/ x (+ y -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -1550000000000.0) {
tmp = 1.0 - log((-1.0 / y));
} else if (y <= 0.02) {
tmp = 1.0 - log1p(((y - x) / (1.0 - y)));
} else {
tmp = 1.0 - log((x / (y + -1.0)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -1550000000000.0) {
tmp = 1.0 - Math.log((-1.0 / y));
} else if (y <= 0.02) {
tmp = 1.0 - Math.log1p(((y - x) / (1.0 - y)));
} else {
tmp = 1.0 - Math.log((x / (y + -1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1550000000000.0: tmp = 1.0 - math.log((-1.0 / y)) elif y <= 0.02: tmp = 1.0 - math.log1p(((y - x) / (1.0 - y))) else: tmp = 1.0 - math.log((x / (y + -1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= -1550000000000.0) tmp = Float64(1.0 - log(Float64(-1.0 / y))); elseif (y <= 0.02) tmp = Float64(1.0 - log1p(Float64(Float64(y - x) / Float64(1.0 - y)))); else tmp = Float64(1.0 - log(Float64(x / Float64(y + -1.0)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -1550000000000.0], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.02], N[(1.0 - N[Log[1 + N[(N[(y - x), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[N[(x / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1550000000000:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 0.02:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{y - x}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{x}{y + -1}\right)\\
\end{array}
\end{array}
if y < -1.55e12Initial program 21.4%
sub-neg21.4%
log1p-def21.4%
distribute-neg-frac21.4%
sub-neg21.4%
distribute-neg-in21.4%
remove-double-neg21.4%
+-commutative21.4%
sub-neg21.4%
Simplified21.4%
Taylor expanded in x around 0 3.7%
log1p-def3.7%
Simplified3.7%
Taylor expanded in y around inf 0.0%
log-rec0.0%
sub-neg0.0%
log-div69.4%
Simplified69.4%
if -1.55e12 < y < 0.0200000000000000004Initial program 99.8%
sub-neg99.8%
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 0.0200000000000000004 < y Initial program 55.2%
sub-neg55.2%
log1p-def55.2%
distribute-neg-frac55.2%
sub-neg55.2%
distribute-neg-in55.2%
remove-double-neg55.2%
+-commutative55.2%
sub-neg55.2%
Simplified55.2%
Taylor expanded in x around inf 57.4%
neg-mul-157.4%
distribute-neg-frac57.4%
Simplified57.4%
frac-2neg57.4%
div-inv57.4%
remove-double-neg57.4%
Applied egg-rr57.4%
Taylor expanded in x around inf 94.1%
+-commutative94.1%
log-rec94.1%
unsub-neg94.1%
mul-1-neg94.1%
log-rec94.1%
remove-double-neg94.1%
sub-neg94.1%
metadata-eval94.1%
+-commutative94.1%
*-rgt-identity94.1%
log-div95.3%
*-rgt-identity95.3%
+-commutative95.3%
Simplified95.3%
Final simplification89.6%
(FPCore (x y)
:precision binary64
(if (<= y -840.0)
(- 1.0 (log (/ -1.0 y)))
(if (<= y 1.0)
(- 1.0 (log1p (/ (- x) (- 1.0 y))))
(- 1.0 (log (/ x (+ y -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -840.0) {
tmp = 1.0 - log((-1.0 / y));
} else if (y <= 1.0) {
tmp = 1.0 - log1p((-x / (1.0 - y)));
} else {
tmp = 1.0 - log((x / (y + -1.0)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -840.0) {
tmp = 1.0 - Math.log((-1.0 / y));
} else if (y <= 1.0) {
tmp = 1.0 - Math.log1p((-x / (1.0 - y)));
} else {
tmp = 1.0 - Math.log((x / (y + -1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -840.0: tmp = 1.0 - math.log((-1.0 / y)) elif y <= 1.0: tmp = 1.0 - math.log1p((-x / (1.0 - y))) else: tmp = 1.0 - math.log((x / (y + -1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= -840.0) tmp = Float64(1.0 - log(Float64(-1.0 / y))); elseif (y <= 1.0) tmp = Float64(1.0 - log1p(Float64(Float64(-x) / Float64(1.0 - y)))); else tmp = Float64(1.0 - log(Float64(x / Float64(y + -1.0)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -840.0], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 - N[Log[1 + N[((-x) / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[N[(x / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -840:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{-x}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{x}{y + -1}\right)\\
\end{array}
\end{array}
if y < -840Initial program 22.9%
sub-neg22.9%
log1p-def22.9%
distribute-neg-frac22.9%
sub-neg22.9%
distribute-neg-in22.9%
remove-double-neg22.9%
+-commutative22.9%
sub-neg22.9%
Simplified22.9%
Taylor expanded in x around 0 5.7%
log1p-def5.7%
Simplified5.7%
Taylor expanded in y around inf 0.0%
log-rec0.0%
sub-neg0.0%
log-div68.8%
Simplified68.8%
if -840 < 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 x around inf 98.8%
neg-mul-198.8%
distribute-neg-frac98.8%
Simplified98.8%
if 1 < y Initial program 55.2%
sub-neg55.2%
log1p-def55.2%
distribute-neg-frac55.2%
sub-neg55.2%
distribute-neg-in55.2%
remove-double-neg55.2%
+-commutative55.2%
sub-neg55.2%
Simplified55.2%
Taylor expanded in x around inf 57.4%
neg-mul-157.4%
distribute-neg-frac57.4%
Simplified57.4%
frac-2neg57.4%
div-inv57.4%
remove-double-neg57.4%
Applied egg-rr57.4%
Taylor expanded in x around inf 94.1%
+-commutative94.1%
log-rec94.1%
unsub-neg94.1%
mul-1-neg94.1%
log-rec94.1%
remove-double-neg94.1%
sub-neg94.1%
metadata-eval94.1%
+-commutative94.1%
*-rgt-identity94.1%
log-div95.3%
*-rgt-identity95.3%
+-commutative95.3%
Simplified95.3%
Final simplification88.6%
(FPCore (x y)
:precision binary64
(if (<= y -155.0)
(- 1.0 (log (/ -1.0 y)))
(if (<= y 0.35)
(- 1.0 (+ y (log1p (- x))))
(- 1.0 (log (/ x (+ y -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -155.0) {
tmp = 1.0 - log((-1.0 / y));
} else if (y <= 0.35) {
tmp = 1.0 - (y + log1p(-x));
} else {
tmp = 1.0 - log((x / (y + -1.0)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -155.0) {
tmp = 1.0 - Math.log((-1.0 / y));
} else if (y <= 0.35) {
tmp = 1.0 - (y + Math.log1p(-x));
} else {
tmp = 1.0 - Math.log((x / (y + -1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -155.0: tmp = 1.0 - math.log((-1.0 / y)) elif y <= 0.35: tmp = 1.0 - (y + math.log1p(-x)) else: tmp = 1.0 - math.log((x / (y + -1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= -155.0) tmp = Float64(1.0 - log(Float64(-1.0 / y))); elseif (y <= 0.35) tmp = Float64(1.0 - Float64(y + log1p(Float64(-x)))); else tmp = Float64(1.0 - log(Float64(x / Float64(y + -1.0)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -155.0], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.35], N[(1.0 - N[(y + N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[N[(x / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -155:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 0.35:\\
\;\;\;\;1 - \left(y + \mathsf{log1p}\left(-x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{x}{y + -1}\right)\\
\end{array}
\end{array}
if y < -155Initial program 22.9%
sub-neg22.9%
log1p-def22.9%
distribute-neg-frac22.9%
sub-neg22.9%
distribute-neg-in22.9%
remove-double-neg22.9%
+-commutative22.9%
sub-neg22.9%
Simplified22.9%
Taylor expanded in x around 0 5.7%
log1p-def5.7%
Simplified5.7%
Taylor expanded in y around inf 0.0%
log-rec0.0%
sub-neg0.0%
log-div68.8%
Simplified68.8%
if -155 < y < 0.34999999999999998Initial 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 98.2%
+-commutative98.2%
div-sub98.2%
mul-1-neg98.2%
sub-neg98.2%
*-inverses98.2%
*-rgt-identity98.2%
log1p-def98.2%
mul-1-neg98.2%
Simplified98.2%
if 0.34999999999999998 < y Initial program 55.2%
sub-neg55.2%
log1p-def55.2%
distribute-neg-frac55.2%
sub-neg55.2%
distribute-neg-in55.2%
remove-double-neg55.2%
+-commutative55.2%
sub-neg55.2%
Simplified55.2%
Taylor expanded in x around inf 57.4%
neg-mul-157.4%
distribute-neg-frac57.4%
Simplified57.4%
frac-2neg57.4%
div-inv57.4%
remove-double-neg57.4%
Applied egg-rr57.4%
Taylor expanded in x around inf 94.1%
+-commutative94.1%
log-rec94.1%
unsub-neg94.1%
mul-1-neg94.1%
log-rec94.1%
remove-double-neg94.1%
sub-neg94.1%
metadata-eval94.1%
+-commutative94.1%
*-rgt-identity94.1%
log-div95.3%
*-rgt-identity95.3%
+-commutative95.3%
Simplified95.3%
Final simplification88.3%
(FPCore (x y) :precision binary64 (if (<= y -155.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 <= -155.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 <= -155.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 <= -155.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 <= -155.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, -155.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 -155:\\
\;\;\;\;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 < -155Initial program 22.9%
sub-neg22.9%
log1p-def22.9%
distribute-neg-frac22.9%
sub-neg22.9%
distribute-neg-in22.9%
remove-double-neg22.9%
+-commutative22.9%
sub-neg22.9%
Simplified22.9%
Taylor expanded in x around 0 5.7%
log1p-def5.7%
Simplified5.7%
Taylor expanded in y around inf 0.0%
log-rec0.0%
sub-neg0.0%
log-div68.8%
Simplified68.8%
if -155 < 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 98.2%
+-commutative98.2%
div-sub98.2%
mul-1-neg98.2%
sub-neg98.2%
*-inverses98.2%
*-rgt-identity98.2%
log1p-def98.2%
mul-1-neg98.2%
Simplified98.2%
if 1 < y Initial program 55.2%
sub-neg55.2%
log1p-def55.2%
distribute-neg-frac55.2%
sub-neg55.2%
distribute-neg-in55.2%
remove-double-neg55.2%
+-commutative55.2%
sub-neg55.2%
Simplified55.2%
Taylor expanded in x around inf 57.4%
neg-mul-157.4%
distribute-neg-frac57.4%
Simplified57.4%
frac-2neg57.4%
div-inv57.4%
remove-double-neg57.4%
Applied egg-rr57.4%
Taylor expanded in y around inf 57.2%
Final simplification84.4%
(FPCore (x y) :precision binary64 (if (<= y -175.0) (- 1.0 (log (/ -1.0 y))) (if (<= y 1.92e-10) (- 1.0 (log1p (- x))) (- 1.0 (log1p (/ x y))))))
double code(double x, double y) {
double tmp;
if (y <= -175.0) {
tmp = 1.0 - log((-1.0 / y));
} else if (y <= 1.92e-10) {
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 <= -175.0) {
tmp = 1.0 - Math.log((-1.0 / y));
} else if (y <= 1.92e-10) {
tmp = 1.0 - Math.log1p(-x);
} else {
tmp = 1.0 - Math.log1p((x / y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -175.0: tmp = 1.0 - math.log((-1.0 / y)) elif y <= 1.92e-10: 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 <= -175.0) tmp = Float64(1.0 - log(Float64(-1.0 / y))); elseif (y <= 1.92e-10) 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, -175.0], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.92e-10], 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 -175:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 1.92 \cdot 10^{-10}:\\
\;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x}{y}\right)\\
\end{array}
\end{array}
if y < -175Initial program 22.9%
sub-neg22.9%
log1p-def22.9%
distribute-neg-frac22.9%
sub-neg22.9%
distribute-neg-in22.9%
remove-double-neg22.9%
+-commutative22.9%
sub-neg22.9%
Simplified22.9%
Taylor expanded in x around 0 5.7%
log1p-def5.7%
Simplified5.7%
Taylor expanded in y around inf 0.0%
log-rec0.0%
sub-neg0.0%
log-div68.8%
Simplified68.8%
if -175 < y < 1.9200000000000001e-10Initial 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 99.0%
log1p-def99.0%
mul-1-neg99.0%
Simplified99.0%
if 1.9200000000000001e-10 < y Initial program 59.8%
sub-neg59.8%
log1p-def59.8%
distribute-neg-frac59.8%
sub-neg59.8%
distribute-neg-in59.8%
remove-double-neg59.8%
+-commutative59.8%
sub-neg59.8%
Simplified59.8%
Taylor expanded in x around inf 55.6%
neg-mul-155.6%
distribute-neg-frac55.6%
Simplified55.6%
frac-2neg55.6%
div-inv55.7%
remove-double-neg55.7%
Applied egg-rr55.7%
Taylor expanded in y around inf 55.5%
Final simplification84.2%
(FPCore (x y) :precision binary64 (if (<= y -850.0) (- 1.0 (log (/ -1.0 y))) (- 1.0 (log1p (- x)))))
double code(double x, double y) {
double tmp;
if (y <= -850.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 <= -850.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 <= -850.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 <= -850.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, -850.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 -850:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\
\end{array}
\end{array}
if y < -850Initial program 22.9%
sub-neg22.9%
log1p-def22.9%
distribute-neg-frac22.9%
sub-neg22.9%
distribute-neg-in22.9%
remove-double-neg22.9%
+-commutative22.9%
sub-neg22.9%
Simplified22.9%
Taylor expanded in x around 0 5.7%
log1p-def5.7%
Simplified5.7%
Taylor expanded in y around inf 0.0%
log-rec0.0%
sub-neg0.0%
log-div68.8%
Simplified68.8%
if -850 < y Initial program 93.2%
sub-neg93.2%
log1p-def93.2%
distribute-neg-frac93.2%
sub-neg93.2%
distribute-neg-in93.2%
remove-double-neg93.2%
+-commutative93.2%
sub-neg93.2%
Simplified93.2%
Taylor expanded in y around 0 83.0%
log1p-def83.0%
mul-1-neg83.0%
Simplified83.0%
Final simplification78.4%
(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 70.1%
sub-neg70.1%
log1p-def70.2%
distribute-neg-frac70.2%
sub-neg70.2%
distribute-neg-in70.2%
remove-double-neg70.2%
+-commutative70.2%
sub-neg70.2%
Simplified70.2%
Taylor expanded in y around 0 59.9%
log1p-def59.9%
mul-1-neg59.9%
Simplified59.9%
Final simplification59.9%
(FPCore (x y) :precision binary64 (+ 1.0 (/ x (- 1.0 y))))
double code(double x, double y) {
return 1.0 + (x / (1.0 - y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + (x / (1.0d0 - y))
end function
public static double code(double x, double y) {
return 1.0 + (x / (1.0 - y));
}
def code(x, y): return 1.0 + (x / (1.0 - y))
function code(x, y) return Float64(1.0 + Float64(x / Float64(1.0 - y))) end
function tmp = code(x, y) tmp = 1.0 + (x / (1.0 - y)); end
code[x_, y_] := N[(1.0 + N[(x / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{x}{1 - y}
\end{array}
Initial program 70.1%
sub-neg70.1%
log1p-def70.2%
distribute-neg-frac70.2%
sub-neg70.2%
distribute-neg-in70.2%
remove-double-neg70.2%
+-commutative70.2%
sub-neg70.2%
Simplified70.2%
Taylor expanded in x around inf 70.9%
neg-mul-170.9%
distribute-neg-frac70.9%
Simplified70.9%
Taylor expanded in x around 0 46.4%
Final simplification46.4%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 70.1%
sub-neg70.1%
log1p-def70.2%
distribute-neg-frac70.2%
sub-neg70.2%
distribute-neg-in70.2%
remove-double-neg70.2%
+-commutative70.2%
sub-neg70.2%
Simplified70.2%
Taylor expanded in x around inf 70.9%
neg-mul-170.9%
distribute-neg-frac70.9%
Simplified70.9%
Taylor expanded in x around 0 45.0%
Final simplification45.0%
(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 2023322
(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))))))