
(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 16 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 -460000.0)
(- 1.0 (+ (/ (/ (- 1.0 x) y) (- 1.0 x)) (- (log1p (- x)) (log (/ y -1.0)))))
(if (<= y 2.9e+61)
(- 1.0 (log1p (* (/ (- x y) (fma y y -1.0)) (+ y 1.0))))
(+ 1.0 (- (log y) (log (+ x -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -460000.0) {
tmp = 1.0 - ((((1.0 - x) / y) / (1.0 - x)) + (log1p(-x) - log((y / -1.0))));
} else if (y <= 2.9e+61) {
tmp = 1.0 - log1p((((x - y) / fma(y, y, -1.0)) * (y + 1.0)));
} else {
tmp = 1.0 + (log(y) - log((x + -1.0)));
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -460000.0) tmp = Float64(1.0 - Float64(Float64(Float64(Float64(1.0 - x) / y) / Float64(1.0 - x)) + Float64(log1p(Float64(-x)) - log(Float64(y / -1.0))))); elseif (y <= 2.9e+61) tmp = Float64(1.0 - log1p(Float64(Float64(Float64(x - y) / fma(y, y, -1.0)) * Float64(y + 1.0)))); else tmp = Float64(1.0 + Float64(log(y) - log(Float64(x + -1.0)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -460000.0], N[(1.0 - N[(N[(N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision] / N[(1.0 - x), $MachinePrecision]), $MachinePrecision] + N[(N[Log[1 + (-x)], $MachinePrecision] - N[Log[N[(y / -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e+61], N[(1.0 - N[Log[1 + N[(N[(N[(x - y), $MachinePrecision] / N[(y * y + -1.0), $MachinePrecision]), $MachinePrecision] * N[(y + 1.0), $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 -460000:\\
\;\;\;\;1 - \left(\frac{\frac{1 - x}{y}}{1 - x} + \left(\mathsf{log1p}\left(-x\right) - \log \left(\frac{y}{-1}\right)\right)\right)\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+61}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{\mathsf{fma}\left(y, y, -1\right)} \cdot \left(y + 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\
\end{array}
\end{array}
if y < -4.6e5Initial program 24.2%
sub-neg24.2%
log1p-define24.2%
distribute-neg-frac224.2%
neg-sub024.2%
associate--r-24.2%
metadata-eval24.2%
+-commutative24.2%
Simplified24.2%
Taylor expanded in y around -inf 99.6%
Simplified99.6%
clear-num99.6%
log-div99.6%
metadata-eval99.6%
Applied egg-rr99.6%
neg-sub099.6%
Simplified99.6%
if -4.6e5 < y < 2.9000000000000001e61Initial program 100.0%
sub-neg100.0%
log1p-define100.0%
distribute-neg-frac2100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
flip-+100.0%
associate-/r/100.0%
metadata-eval100.0%
fma-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
if 2.9000000000000001e61 < y Initial program 36.4%
sub-neg36.4%
log1p-define36.4%
distribute-neg-frac236.4%
neg-sub036.4%
associate--r-36.4%
metadata-eval36.4%
+-commutative36.4%
Simplified36.4%
Taylor expanded in y around inf 99.2%
log-rec99.2%
unsub-neg99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(if (<= y -3050000000.0)
(- 1.0 (+ (log1p (- x)) (log (/ -1.0 y))))
(if (<= y 2.6e+61)
(- 1.0 (log1p (* (/ (- x y) (fma y y -1.0)) (+ y 1.0))))
(+ 1.0 (- (log y) (log (+ x -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -3050000000.0) {
tmp = 1.0 - (log1p(-x) + log((-1.0 / y)));
} else if (y <= 2.6e+61) {
tmp = 1.0 - log1p((((x - y) / fma(y, y, -1.0)) * (y + 1.0)));
} else {
tmp = 1.0 + (log(y) - log((x + -1.0)));
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -3050000000.0) tmp = Float64(1.0 - Float64(log1p(Float64(-x)) + log(Float64(-1.0 / y)))); elseif (y <= 2.6e+61) tmp = Float64(1.0 - log1p(Float64(Float64(Float64(x - y) / fma(y, y, -1.0)) * Float64(y + 1.0)))); else tmp = Float64(1.0 + Float64(log(y) - log(Float64(x + -1.0)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -3050000000.0], N[(1.0 - N[(N[Log[1 + (-x)], $MachinePrecision] + N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+61], N[(1.0 - N[Log[1 + N[(N[(N[(x - y), $MachinePrecision] / N[(y * y + -1.0), $MachinePrecision]), $MachinePrecision] * N[(y + 1.0), $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 -3050000000:\\
\;\;\;\;1 - \left(\mathsf{log1p}\left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+61}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{\mathsf{fma}\left(y, y, -1\right)} \cdot \left(y + 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\
\end{array}
\end{array}
if y < -3.05e9Initial program 24.2%
sub-neg24.2%
log1p-define24.2%
distribute-neg-frac224.2%
neg-sub024.2%
associate--r-24.2%
metadata-eval24.2%
+-commutative24.2%
Simplified24.2%
Taylor expanded in y around -inf 98.8%
sub-neg98.8%
metadata-eval98.8%
distribute-lft-in98.8%
metadata-eval98.8%
+-commutative98.8%
log1p-define98.8%
mul-1-neg98.8%
Simplified98.8%
if -3.05e9 < y < 2.59999999999999973e61Initial program 100.0%
sub-neg100.0%
log1p-define100.0%
distribute-neg-frac2100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
flip-+100.0%
associate-/r/100.0%
metadata-eval100.0%
fma-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
if 2.59999999999999973e61 < y Initial program 36.4%
sub-neg36.4%
log1p-define36.4%
distribute-neg-frac236.4%
neg-sub036.4%
associate--r-36.4%
metadata-eval36.4%
+-commutative36.4%
Simplified36.4%
Taylor expanded in y around inf 99.2%
log-rec99.2%
unsub-neg99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(if (<= y -510000.0)
(+
1.0
(- (/ (/ (- 1.0 x) y) (+ x -1.0)) (+ (log1p (- x)) (log (/ -1.0 y)))))
(if (<= y 2.6e+61)
(- 1.0 (log1p (* (/ (- x y) (fma y y -1.0)) (+ y 1.0))))
(+ 1.0 (- (log y) (log (+ x -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -510000.0) {
tmp = 1.0 + ((((1.0 - x) / y) / (x + -1.0)) - (log1p(-x) + log((-1.0 / y))));
} else if (y <= 2.6e+61) {
tmp = 1.0 - log1p((((x - y) / fma(y, y, -1.0)) * (y + 1.0)));
} else {
tmp = 1.0 + (log(y) - log((x + -1.0)));
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -510000.0) tmp = Float64(1.0 + Float64(Float64(Float64(Float64(1.0 - x) / y) / Float64(x + -1.0)) - Float64(log1p(Float64(-x)) + log(Float64(-1.0 / y))))); elseif (y <= 2.6e+61) tmp = Float64(1.0 - log1p(Float64(Float64(Float64(x - y) / fma(y, y, -1.0)) * Float64(y + 1.0)))); else tmp = Float64(1.0 + Float64(log(y) - log(Float64(x + -1.0)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -510000.0], N[(1.0 + N[(N[(N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision] / N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - N[(N[Log[1 + (-x)], $MachinePrecision] + N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+61], N[(1.0 - N[Log[1 + N[(N[(N[(x - y), $MachinePrecision] / N[(y * y + -1.0), $MachinePrecision]), $MachinePrecision] * N[(y + 1.0), $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 -510000:\\
\;\;\;\;1 + \left(\frac{\frac{1 - x}{y}}{x + -1} - \left(\mathsf{log1p}\left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\right)\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+61}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{\mathsf{fma}\left(y, y, -1\right)} \cdot \left(y + 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\
\end{array}
\end{array}
if y < -5.1e5Initial program 24.2%
sub-neg24.2%
log1p-define24.2%
distribute-neg-frac224.2%
neg-sub024.2%
associate--r-24.2%
metadata-eval24.2%
+-commutative24.2%
Simplified24.2%
Taylor expanded in y around -inf 99.6%
Simplified99.6%
if -5.1e5 < y < 2.59999999999999973e61Initial program 100.0%
sub-neg100.0%
log1p-define100.0%
distribute-neg-frac2100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
flip-+100.0%
associate-/r/100.0%
metadata-eval100.0%
fma-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
if 2.59999999999999973e61 < y Initial program 36.4%
sub-neg36.4%
log1p-define36.4%
distribute-neg-frac236.4%
neg-sub036.4%
associate--r-36.4%
metadata-eval36.4%
+-commutative36.4%
Simplified36.4%
Taylor expanded in y around inf 99.2%
log-rec99.2%
unsub-neg99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(if (<= y -4.3e+39)
(- 1.0 (log (/ -1.0 y)))
(if (<= y 2.9e+61)
(- 1.0 (log1p (* (- x y) (/ -1.0 (- 1.0 y)))))
(+ 1.0 (- (log y) (log (+ x -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -4.3e+39) {
tmp = 1.0 - log((-1.0 / y));
} else if (y <= 2.9e+61) {
tmp = 1.0 - log1p(((x - y) * (-1.0 / (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 <= -4.3e+39) {
tmp = 1.0 - Math.log((-1.0 / y));
} else if (y <= 2.9e+61) {
tmp = 1.0 - Math.log1p(((x - y) * (-1.0 / (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 <= -4.3e+39: tmp = 1.0 - math.log((-1.0 / y)) elif y <= 2.9e+61: tmp = 1.0 - math.log1p(((x - y) * (-1.0 / (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 <= -4.3e+39) tmp = Float64(1.0 - log(Float64(-1.0 / y))); elseif (y <= 2.9e+61) tmp = Float64(1.0 - log1p(Float64(Float64(x - y) * Float64(-1.0 / 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, -4.3e+39], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e+61], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] * N[(-1.0 / N[(1.0 - y), $MachinePrecision]), $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 -4.3 \cdot 10^{+39}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+61}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\left(x - y\right) \cdot \frac{-1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\
\end{array}
\end{array}
if y < -4.3e39Initial program 16.3%
sub-neg16.3%
log1p-define16.3%
distribute-neg-frac216.3%
neg-sub016.3%
associate--r-16.3%
metadata-eval16.3%
+-commutative16.3%
Simplified16.3%
Taylor expanded in x around 0 2.8%
sub-neg2.8%
metadata-eval2.8%
neg-mul-12.8%
distribute-neg-frac2.8%
Simplified2.8%
Taylor expanded in y around -inf 68.8%
if -4.3e39 < y < 2.9000000000000001e61Initial program 97.7%
sub-neg97.7%
log1p-define97.8%
distribute-neg-frac297.8%
neg-sub097.8%
associate--r-97.8%
metadata-eval97.8%
+-commutative97.8%
Simplified97.8%
clear-num97.7%
associate-/r/97.8%
Applied egg-rr97.8%
if 2.9000000000000001e61 < y Initial program 36.4%
sub-neg36.4%
log1p-define36.4%
distribute-neg-frac236.4%
neg-sub036.4%
associate--r-36.4%
metadata-eval36.4%
+-commutative36.4%
Simplified36.4%
Taylor expanded in y around inf 99.2%
log-rec99.2%
unsub-neg99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification91.6%
(FPCore (x y)
:precision binary64
(if (<= y -6900000000.0)
(- 1.0 (+ (log1p (- x)) (log (/ -1.0 y))))
(if (<= y 2.6e+61)
(- 1.0 (log1p (/ (- x y) (+ y -1.0))))
(+ 1.0 (- (log y) (log (+ x -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -6900000000.0) {
tmp = 1.0 - (log1p(-x) + log((-1.0 / y)));
} else if (y <= 2.6e+61) {
tmp = 1.0 - log1p(((x - y) / (y + -1.0)));
} else {
tmp = 1.0 + (log(y) - log((x + -1.0)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -6900000000.0) {
tmp = 1.0 - (Math.log1p(-x) + Math.log((-1.0 / y)));
} else if (y <= 2.6e+61) {
tmp = 1.0 - Math.log1p(((x - y) / (y + -1.0)));
} else {
tmp = 1.0 + (Math.log(y) - Math.log((x + -1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6900000000.0: tmp = 1.0 - (math.log1p(-x) + math.log((-1.0 / y))) elif y <= 2.6e+61: tmp = 1.0 - math.log1p(((x - y) / (y + -1.0))) else: tmp = 1.0 + (math.log(y) - math.log((x + -1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= -6900000000.0) tmp = Float64(1.0 - Float64(log1p(Float64(-x)) + log(Float64(-1.0 / y)))); elseif (y <= 2.6e+61) tmp = Float64(1.0 - log1p(Float64(Float64(x - y) / Float64(y + -1.0)))); else tmp = Float64(1.0 + Float64(log(y) - log(Float64(x + -1.0)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -6900000000.0], N[(1.0 - N[(N[Log[1 + (-x)], $MachinePrecision] + N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+61], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] / N[(y + -1.0), $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 -6900000000:\\
\;\;\;\;1 - \left(\mathsf{log1p}\left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+61}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\log y - \log \left(x + -1\right)\right)\\
\end{array}
\end{array}
if y < -6.9e9Initial program 24.2%
sub-neg24.2%
log1p-define24.2%
distribute-neg-frac224.2%
neg-sub024.2%
associate--r-24.2%
metadata-eval24.2%
+-commutative24.2%
Simplified24.2%
Taylor expanded in y around -inf 98.8%
sub-neg98.8%
metadata-eval98.8%
distribute-lft-in98.8%
metadata-eval98.8%
+-commutative98.8%
log1p-define98.8%
mul-1-neg98.8%
Simplified98.8%
if -6.9e9 < y < 2.59999999999999973e61Initial program 100.0%
sub-neg100.0%
log1p-define100.0%
distribute-neg-frac2100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
if 2.59999999999999973e61 < y Initial program 36.4%
sub-neg36.4%
log1p-define36.4%
distribute-neg-frac236.4%
neg-sub036.4%
associate--r-36.4%
metadata-eval36.4%
+-commutative36.4%
Simplified36.4%
Taylor expanded in y around inf 99.2%
log-rec99.2%
unsub-neg99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (log (/ -1.0 y)))) (t_1 (- 1.0 (log1p (/ x (+ y -1.0))))))
(if (<= y -9.4e+39)
t_0
(if (<= y -1.3e+19)
t_1
(if (<= y -180000000.0)
t_0
(if (<= y -6.4e-18) (- 1.0 (log1p (/ y (- 1.0 y)))) t_1))))))
double code(double x, double y) {
double t_0 = 1.0 - log((-1.0 / y));
double t_1 = 1.0 - log1p((x / (y + -1.0)));
double tmp;
if (y <= -9.4e+39) {
tmp = t_0;
} else if (y <= -1.3e+19) {
tmp = t_1;
} else if (y <= -180000000.0) {
tmp = t_0;
} else if (y <= -6.4e-18) {
tmp = 1.0 - log1p((y / (1.0 - y)));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = 1.0 - Math.log((-1.0 / y));
double t_1 = 1.0 - Math.log1p((x / (y + -1.0)));
double tmp;
if (y <= -9.4e+39) {
tmp = t_0;
} else if (y <= -1.3e+19) {
tmp = t_1;
} else if (y <= -180000000.0) {
tmp = t_0;
} else if (y <= -6.4e-18) {
tmp = 1.0 - Math.log1p((y / (1.0 - y)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - math.log((-1.0 / y)) t_1 = 1.0 - math.log1p((x / (y + -1.0))) tmp = 0 if y <= -9.4e+39: tmp = t_0 elif y <= -1.3e+19: tmp = t_1 elif y <= -180000000.0: tmp = t_0 elif y <= -6.4e-18: tmp = 1.0 - math.log1p((y / (1.0 - y))) else: tmp = t_1 return tmp
function code(x, y) t_0 = Float64(1.0 - log(Float64(-1.0 / y))) t_1 = Float64(1.0 - log1p(Float64(x / Float64(y + -1.0)))) tmp = 0.0 if (y <= -9.4e+39) tmp = t_0; elseif (y <= -1.3e+19) tmp = t_1; elseif (y <= -180000000.0) tmp = t_0; elseif (y <= -6.4e-18) tmp = Float64(1.0 - log1p(Float64(y / Float64(1.0 - y)))); else tmp = t_1; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Log[1 + N[(x / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.4e+39], t$95$0, If[LessEqual[y, -1.3e+19], t$95$1, If[LessEqual[y, -180000000.0], t$95$0, If[LessEqual[y, -6.4e-18], N[(1.0 - N[Log[1 + N[(y / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \log \left(\frac{-1}{y}\right)\\
t_1 := 1 - \mathsf{log1p}\left(\frac{x}{y + -1}\right)\\
\mathbf{if}\;y \leq -9.4 \cdot 10^{+39}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.3 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -180000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -6.4 \cdot 10^{-18}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{y}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.3999999999999998e39 or -1.3e19 < y < -1.8e8Initial program 18.4%
sub-neg18.4%
log1p-define18.4%
distribute-neg-frac218.4%
neg-sub018.4%
associate--r-18.4%
metadata-eval18.4%
+-commutative18.4%
Simplified18.4%
Taylor expanded in x around 0 6.0%
sub-neg6.0%
metadata-eval6.0%
neg-mul-16.0%
distribute-neg-frac6.0%
Simplified6.0%
Taylor expanded in y around -inf 70.5%
if -9.3999999999999998e39 < y < -1.3e19 or -6.3999999999999998e-18 < y Initial program 91.4%
sub-neg91.4%
log1p-define91.4%
distribute-neg-frac291.4%
neg-sub091.4%
associate--r-91.4%
metadata-eval91.4%
+-commutative91.4%
Simplified91.4%
Taylor expanded in x around inf 90.6%
if -1.8e8 < y < -6.3999999999999998e-18Initial program 99.7%
sub-neg99.7%
log1p-define99.7%
distribute-neg-frac299.7%
neg-sub099.7%
associate--r-99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
clear-num99.7%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 83.3%
sub-neg83.3%
mul-1-neg83.3%
log1p-define83.3%
mul-1-neg83.3%
sub-neg83.3%
metadata-eval83.3%
distribute-neg-frac283.3%
+-commutative83.3%
distribute-neg-in83.3%
metadata-eval83.3%
unsub-neg83.3%
Simplified83.3%
Final simplification85.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (log (/ -1.0 y)))))
(if (<= y -3.8e+39)
t_0
(if (<= y -1.42e+19)
(- 1.0 (log1p (* (/ -1.0 y) (- y x))))
(if (<= y -180000000.0)
t_0
(if (<= y -6.4e-18)
(- 1.0 (log1p (/ y (- 1.0 y))))
(- 1.0 (log1p (/ x (+ y -1.0))))))))))
double code(double x, double y) {
double t_0 = 1.0 - log((-1.0 / y));
double tmp;
if (y <= -3.8e+39) {
tmp = t_0;
} else if (y <= -1.42e+19) {
tmp = 1.0 - log1p(((-1.0 / y) * (y - x)));
} else if (y <= -180000000.0) {
tmp = t_0;
} else if (y <= -6.4e-18) {
tmp = 1.0 - log1p((y / (1.0 - y)));
} else {
tmp = 1.0 - log1p((x / (y + -1.0)));
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = 1.0 - Math.log((-1.0 / y));
double tmp;
if (y <= -3.8e+39) {
tmp = t_0;
} else if (y <= -1.42e+19) {
tmp = 1.0 - Math.log1p(((-1.0 / y) * (y - x)));
} else if (y <= -180000000.0) {
tmp = t_0;
} else if (y <= -6.4e-18) {
tmp = 1.0 - Math.log1p((y / (1.0 - y)));
} else {
tmp = 1.0 - Math.log1p((x / (y + -1.0)));
}
return tmp;
}
def code(x, y): t_0 = 1.0 - math.log((-1.0 / y)) tmp = 0 if y <= -3.8e+39: tmp = t_0 elif y <= -1.42e+19: tmp = 1.0 - math.log1p(((-1.0 / y) * (y - x))) elif y <= -180000000.0: tmp = t_0 elif y <= -6.4e-18: tmp = 1.0 - math.log1p((y / (1.0 - y))) else: tmp = 1.0 - math.log1p((x / (y + -1.0))) return tmp
function code(x, y) t_0 = Float64(1.0 - log(Float64(-1.0 / y))) tmp = 0.0 if (y <= -3.8e+39) tmp = t_0; elseif (y <= -1.42e+19) tmp = Float64(1.0 - log1p(Float64(Float64(-1.0 / y) * Float64(y - x)))); elseif (y <= -180000000.0) tmp = t_0; elseif (y <= -6.4e-18) tmp = Float64(1.0 - log1p(Float64(y / Float64(1.0 - y)))); else tmp = Float64(1.0 - log1p(Float64(x / Float64(y + -1.0)))); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.8e+39], t$95$0, If[LessEqual[y, -1.42e+19], N[(1.0 - N[Log[1 + N[(N[(-1.0 / y), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -180000000.0], t$95$0, If[LessEqual[y, -6.4e-18], N[(1.0 - N[Log[1 + N[(y / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[1 + N[(x / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{if}\;y \leq -3.8 \cdot 10^{+39}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.42 \cdot 10^{+19}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{-1}{y} \cdot \left(y - x\right)\right)\\
\mathbf{elif}\;y \leq -180000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -6.4 \cdot 10^{-18}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{y}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x}{y + -1}\right)\\
\end{array}
\end{array}
if y < -3.7999999999999998e39 or -1.42e19 < y < -1.8e8Initial program 18.4%
sub-neg18.4%
log1p-define18.4%
distribute-neg-frac218.4%
neg-sub018.4%
associate--r-18.4%
metadata-eval18.4%
+-commutative18.4%
Simplified18.4%
Taylor expanded in x around 0 6.0%
sub-neg6.0%
metadata-eval6.0%
neg-mul-16.0%
distribute-neg-frac6.0%
Simplified6.0%
Taylor expanded in y around -inf 70.5%
if -3.7999999999999998e39 < y < -1.42e19Initial program 83.9%
sub-neg83.9%
log1p-define83.9%
distribute-neg-frac283.9%
neg-sub083.9%
associate--r-83.9%
metadata-eval83.9%
+-commutative83.9%
Simplified83.9%
clear-num83.9%
associate-/r/86.4%
Applied egg-rr86.4%
Taylor expanded in y around inf 86.4%
if -1.8e8 < y < -6.3999999999999998e-18Initial program 99.7%
sub-neg99.7%
log1p-define99.7%
distribute-neg-frac299.7%
neg-sub099.7%
associate--r-99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
clear-num99.7%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 83.3%
sub-neg83.3%
mul-1-neg83.3%
log1p-define83.3%
mul-1-neg83.3%
sub-neg83.3%
metadata-eval83.3%
distribute-neg-frac283.3%
+-commutative83.3%
distribute-neg-in83.3%
metadata-eval83.3%
unsub-neg83.3%
Simplified83.3%
if -6.3999999999999998e-18 < y Initial program 91.6%
sub-neg91.6%
log1p-define91.7%
distribute-neg-frac291.7%
neg-sub091.7%
associate--r-91.7%
metadata-eval91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in x around inf 90.7%
Final simplification85.6%
(FPCore (x y)
:precision binary64
(if (<= y -4e+39)
(- 1.0 (log (/ -1.0 y)))
(if (<= y 700000000.0)
(- 1.0 (log1p (* (- x y) (/ -1.0 (- 1.0 y)))))
(- 1.0 (+ (/ (/ (- 1.0 x) y) (- 1.0 x)) (log (/ (+ 1.0 x) y)))))))
double code(double x, double y) {
double tmp;
if (y <= -4e+39) {
tmp = 1.0 - log((-1.0 / y));
} else if (y <= 700000000.0) {
tmp = 1.0 - log1p(((x - y) * (-1.0 / (1.0 - y))));
} else {
tmp = 1.0 - ((((1.0 - x) / y) / (1.0 - x)) + log(((1.0 + x) / y)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -4e+39) {
tmp = 1.0 - Math.log((-1.0 / y));
} else if (y <= 700000000.0) {
tmp = 1.0 - Math.log1p(((x - y) * (-1.0 / (1.0 - y))));
} else {
tmp = 1.0 - ((((1.0 - x) / y) / (1.0 - x)) + Math.log(((1.0 + x) / y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4e+39: tmp = 1.0 - math.log((-1.0 / y)) elif y <= 700000000.0: tmp = 1.0 - math.log1p(((x - y) * (-1.0 / (1.0 - y)))) else: tmp = 1.0 - ((((1.0 - x) / y) / (1.0 - x)) + math.log(((1.0 + x) / y))) return tmp
function code(x, y) tmp = 0.0 if (y <= -4e+39) tmp = Float64(1.0 - log(Float64(-1.0 / y))); elseif (y <= 700000000.0) tmp = Float64(1.0 - log1p(Float64(Float64(x - y) * Float64(-1.0 / Float64(1.0 - y))))); else tmp = Float64(1.0 - Float64(Float64(Float64(Float64(1.0 - x) / y) / Float64(1.0 - x)) + log(Float64(Float64(1.0 + x) / y)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -4e+39], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 700000000.0], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] * N[(-1.0 / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision] / N[(1.0 - x), $MachinePrecision]), $MachinePrecision] + N[Log[N[(N[(1.0 + x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+39}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 700000000:\\
\;\;\;\;1 - \mathsf{log1p}\left(\left(x - y\right) \cdot \frac{-1}{1 - y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \left(\frac{\frac{1 - x}{y}}{1 - x} + \log \left(\frac{1 + x}{y}\right)\right)\\
\end{array}
\end{array}
if y < -3.99999999999999976e39Initial program 16.3%
sub-neg16.3%
log1p-define16.3%
distribute-neg-frac216.3%
neg-sub016.3%
associate--r-16.3%
metadata-eval16.3%
+-commutative16.3%
Simplified16.3%
Taylor expanded in x around 0 2.8%
sub-neg2.8%
metadata-eval2.8%
neg-mul-12.8%
distribute-neg-frac2.8%
Simplified2.8%
Taylor expanded in y around -inf 68.8%
if -3.99999999999999976e39 < y < 7e8Initial program 97.7%
sub-neg97.7%
log1p-define97.7%
distribute-neg-frac297.7%
neg-sub097.7%
associate--r-97.7%
metadata-eval97.7%
+-commutative97.7%
Simplified97.7%
clear-num97.7%
associate-/r/97.8%
Applied egg-rr97.8%
if 7e8 < y Initial program 47.4%
sub-neg47.4%
log1p-define47.4%
distribute-neg-frac247.4%
neg-sub047.4%
associate--r-47.4%
metadata-eval47.4%
+-commutative47.4%
Simplified47.4%
Taylor expanded in y around -inf 0.0%
Simplified0.0%
log1p-undefine0.0%
sub-neg0.0%
metadata-eval0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
frac-2neg0.0%
log-prod0.0%
div-inv0.0%
sub-neg0.0%
add-sqr-sqrt0.0%
sqrt-unprod60.6%
sqr-neg60.6%
sqrt-unprod97.7%
add-sqr-sqrt97.7%
Applied egg-rr97.7%
Final simplification91.4%
(FPCore (x y) :precision binary64 (if (<= (+ 1.0 (/ (- x y) (+ y -1.0))) 1e-10) (+ 1.0 (- (/ -1.0 y) (log (/ -1.0 y)))) (- 1.0 (log1p (* x (/ (- 1.0 (/ y x)) (+ y -1.0)))))))
double code(double x, double y) {
double tmp;
if ((1.0 + ((x - y) / (y + -1.0))) <= 1e-10) {
tmp = 1.0 + ((-1.0 / y) - log((-1.0 / y)));
} else {
tmp = 1.0 - log1p((x * ((1.0 - (y / x)) / (y + -1.0))));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if ((1.0 + ((x - y) / (y + -1.0))) <= 1e-10) {
tmp = 1.0 + ((-1.0 / y) - Math.log((-1.0 / y)));
} else {
tmp = 1.0 - Math.log1p((x * ((1.0 - (y / x)) / (y + -1.0))));
}
return tmp;
}
def code(x, y): tmp = 0 if (1.0 + ((x - y) / (y + -1.0))) <= 1e-10: tmp = 1.0 + ((-1.0 / y) - math.log((-1.0 / y))) else: tmp = 1.0 - math.log1p((x * ((1.0 - (y / x)) / (y + -1.0)))) return tmp
function code(x, y) tmp = 0.0 if (Float64(1.0 + Float64(Float64(x - y) / Float64(y + -1.0))) <= 1e-10) tmp = Float64(1.0 + Float64(Float64(-1.0 / y) - log(Float64(-1.0 / y)))); else tmp = Float64(1.0 - log1p(Float64(x * Float64(Float64(1.0 - Float64(y / x)) / Float64(y + -1.0))))); end return tmp end
code[x_, y_] := If[LessEqual[N[(1.0 + N[(N[(x - y), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-10], N[(1.0 + N[(N[(-1.0 / y), $MachinePrecision] - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[1 + N[(x * N[(N[(1.0 - N[(y / x), $MachinePrecision]), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;1 + \frac{x - y}{y + -1} \leq 10^{-10}:\\
\;\;\;\;1 + \left(\frac{-1}{y} - \log \left(\frac{-1}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(x \cdot \frac{1 - \frac{y}{x}}{y + -1}\right)\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 (-.f64 x y) (-.f64 #s(literal 1 binary64) y))) < 1.00000000000000004e-10Initial program 6.5%
sub-neg6.5%
log1p-define6.5%
distribute-neg-frac26.5%
neg-sub06.5%
associate--r-6.5%
metadata-eval6.5%
+-commutative6.5%
Simplified6.5%
Taylor expanded in x around 0 5.9%
sub-neg5.9%
metadata-eval5.9%
neg-mul-15.9%
distribute-neg-frac5.9%
Simplified5.9%
Taylor expanded in y around -inf 63.2%
+-commutative63.2%
Simplified63.2%
if 1.00000000000000004e-10 < (-.f64 #s(literal 1 binary64) (/.f64 (-.f64 x y) (-.f64 #s(literal 1 binary64) y))) Initial program 99.7%
sub-neg99.7%
log1p-define99.7%
distribute-neg-frac299.7%
neg-sub099.7%
associate--r-99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
mul-1-neg99.4%
unsub-neg99.4%
sub-neg99.4%
metadata-eval99.4%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in x around inf 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
metadata-eval99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
cancel-sign-sub-inv99.4%
*-lft-identity99.4%
associate-/r*99.7%
div-sub99.7%
Simplified99.7%
Final simplification89.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (- x y) (+ y -1.0))))
(if (<= (+ 1.0 t_0) 1e-10)
(+ 1.0 (- (/ -1.0 y) (log (/ -1.0 y))))
(- 1.0 (log1p t_0)))))
double code(double x, double y) {
double t_0 = (x - y) / (y + -1.0);
double tmp;
if ((1.0 + t_0) <= 1e-10) {
tmp = 1.0 + ((-1.0 / y) - log((-1.0 / y)));
} else {
tmp = 1.0 - log1p(t_0);
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = (x - y) / (y + -1.0);
double tmp;
if ((1.0 + t_0) <= 1e-10) {
tmp = 1.0 + ((-1.0 / y) - Math.log((-1.0 / y)));
} else {
tmp = 1.0 - Math.log1p(t_0);
}
return tmp;
}
def code(x, y): t_0 = (x - y) / (y + -1.0) tmp = 0 if (1.0 + t_0) <= 1e-10: tmp = 1.0 + ((-1.0 / y) - math.log((-1.0 / y))) else: tmp = 1.0 - math.log1p(t_0) return tmp
function code(x, y) t_0 = Float64(Float64(x - y) / Float64(y + -1.0)) tmp = 0.0 if (Float64(1.0 + t_0) <= 1e-10) tmp = Float64(1.0 + Float64(Float64(-1.0 / y) - log(Float64(-1.0 / y)))); else tmp = Float64(1.0 - log1p(t_0)); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(x - y), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 + t$95$0), $MachinePrecision], 1e-10], N[(1.0 + N[(N[(-1.0 / y), $MachinePrecision] - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[1 + t$95$0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x - y}{y + -1}\\
\mathbf{if}\;1 + t\_0 \leq 10^{-10}:\\
\;\;\;\;1 + \left(\frac{-1}{y} - \log \left(\frac{-1}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(t\_0\right)\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 (-.f64 x y) (-.f64 #s(literal 1 binary64) y))) < 1.00000000000000004e-10Initial program 6.5%
sub-neg6.5%
log1p-define6.5%
distribute-neg-frac26.5%
neg-sub06.5%
associate--r-6.5%
metadata-eval6.5%
+-commutative6.5%
Simplified6.5%
Taylor expanded in x around 0 5.9%
sub-neg5.9%
metadata-eval5.9%
neg-mul-15.9%
distribute-neg-frac5.9%
Simplified5.9%
Taylor expanded in y around -inf 63.2%
+-commutative63.2%
Simplified63.2%
if 1.00000000000000004e-10 < (-.f64 #s(literal 1 binary64) (/.f64 (-.f64 x y) (-.f64 #s(literal 1 binary64) y))) Initial program 99.7%
sub-neg99.7%
log1p-define99.7%
distribute-neg-frac299.7%
neg-sub099.7%
associate--r-99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Final simplification89.7%
(FPCore (x y) :precision binary64 (if (<= y -3.8e+39) (- 1.0 (log (/ -1.0 y))) (- 1.0 (log1p (/ (- x y) (+ y -1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -3.8e+39) {
tmp = 1.0 - log((-1.0 / y));
} else {
tmp = 1.0 - log1p(((x - y) / (y + -1.0)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -3.8e+39) {
tmp = 1.0 - Math.log((-1.0 / y));
} else {
tmp = 1.0 - Math.log1p(((x - y) / (y + -1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.8e+39: tmp = 1.0 - math.log((-1.0 / y)) else: tmp = 1.0 - math.log1p(((x - y) / (y + -1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= -3.8e+39) tmp = Float64(1.0 - log(Float64(-1.0 / y))); else tmp = Float64(1.0 - log1p(Float64(Float64(x - y) / Float64(y + -1.0)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -3.8e+39], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+39}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)\\
\end{array}
\end{array}
if y < -3.7999999999999998e39Initial program 16.3%
sub-neg16.3%
log1p-define16.3%
distribute-neg-frac216.3%
neg-sub016.3%
associate--r-16.3%
metadata-eval16.3%
+-commutative16.3%
Simplified16.3%
Taylor expanded in x around 0 2.8%
sub-neg2.8%
metadata-eval2.8%
neg-mul-12.8%
distribute-neg-frac2.8%
Simplified2.8%
Taylor expanded in y around -inf 68.8%
if -3.7999999999999998e39 < y Initial program 90.4%
sub-neg90.4%
log1p-define90.4%
distribute-neg-frac290.4%
neg-sub090.4%
associate--r-90.4%
metadata-eval90.4%
+-commutative90.4%
Simplified90.4%
Final simplification85.7%
(FPCore (x y) :precision binary64 (if (<= y -4.7e+39) (- 1.0 (log (/ -1.0 y))) (- 1.0 (log1p (/ x (+ y -1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -4.7e+39) {
tmp = 1.0 - log((-1.0 / y));
} else {
tmp = 1.0 - log1p((x / (y + -1.0)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -4.7e+39) {
tmp = 1.0 - Math.log((-1.0 / y));
} else {
tmp = 1.0 - Math.log1p((x / (y + -1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.7e+39: tmp = 1.0 - math.log((-1.0 / y)) else: tmp = 1.0 - math.log1p((x / (y + -1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= -4.7e+39) tmp = Float64(1.0 - log(Float64(-1.0 / y))); else tmp = Float64(1.0 - log1p(Float64(x / Float64(y + -1.0)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -4.7e+39], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 - N[Log[1 + N[(x / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.7 \cdot 10^{+39}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x}{y + -1}\right)\\
\end{array}
\end{array}
if y < -4.6999999999999999e39Initial program 16.3%
sub-neg16.3%
log1p-define16.3%
distribute-neg-frac216.3%
neg-sub016.3%
associate--r-16.3%
metadata-eval16.3%
+-commutative16.3%
Simplified16.3%
Taylor expanded in x around 0 2.8%
sub-neg2.8%
metadata-eval2.8%
neg-mul-12.8%
distribute-neg-frac2.8%
Simplified2.8%
Taylor expanded in y around -inf 68.8%
if -4.6999999999999999e39 < y Initial program 90.4%
sub-neg90.4%
log1p-define90.4%
distribute-neg-frac290.4%
neg-sub090.4%
associate--r-90.4%
metadata-eval90.4%
+-commutative90.4%
Simplified90.4%
Taylor expanded in x around inf 87.9%
Final simplification83.7%
(FPCore (x y) :precision binary64 (if (<= y -2.4) (- 1.0 (log (/ -1.0 y))) (- 1.0 (+ y (log1p (- x))))))
double code(double x, double y) {
double tmp;
if (y <= -2.4) {
tmp = 1.0 - log((-1.0 / y));
} else {
tmp = 1.0 - (y + log1p(-x));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -2.4) {
tmp = 1.0 - Math.log((-1.0 / y));
} else {
tmp = 1.0 - (y + Math.log1p(-x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.4: tmp = 1.0 - math.log((-1.0 / y)) else: tmp = 1.0 - (y + math.log1p(-x)) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.4) tmp = Float64(1.0 - log(Float64(-1.0 / y))); else tmp = Float64(1.0 - Float64(y + log1p(Float64(-x)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -2.4], N[(1.0 - N[Log[N[(-1.0 / y), $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 -2.4:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \left(y + \mathsf{log1p}\left(-x\right)\right)\\
\end{array}
\end{array}
if y < -2.39999999999999991Initial program 26.4%
sub-neg26.4%
log1p-define26.4%
distribute-neg-frac226.4%
neg-sub026.4%
associate--r-26.4%
metadata-eval26.4%
+-commutative26.4%
Simplified26.4%
Taylor expanded in x around 0 8.2%
sub-neg8.2%
metadata-eval8.2%
neg-mul-18.2%
distribute-neg-frac8.2%
Simplified8.2%
Taylor expanded in y around -inf 64.5%
if -2.39999999999999991 < y Initial program 91.8%
sub-neg91.8%
log1p-define91.8%
distribute-neg-frac291.8%
neg-sub091.8%
associate--r-91.8%
metadata-eval91.8%
+-commutative91.8%
Simplified91.8%
Taylor expanded in y around 0 83.0%
+-commutative83.0%
div-sub83.0%
fma-define83.0%
mul-1-neg83.0%
sub-neg83.0%
*-inverses83.0%
+-commutative83.0%
metadata-eval83.0%
distribute-lft-in83.0%
metadata-eval83.0%
sub-neg83.0%
fma-undefine83.0%
*-rgt-identity83.0%
sub-neg83.0%
metadata-eval83.0%
distribute-lft-in83.0%
metadata-eval83.0%
+-commutative83.0%
Simplified83.0%
Final simplification78.1%
(FPCore (x y) :precision binary64 (if (<= y -2.4) (- 1.0 (log (/ -1.0 y))) (- 1.0 (log1p (- x)))))
double code(double x, double y) {
double tmp;
if (y <= -2.4) {
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 <= -2.4) {
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 <= -2.4: 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 <= -2.4) 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, -2.4], 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 -2.4:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\
\end{array}
\end{array}
if y < -2.39999999999999991Initial program 26.4%
sub-neg26.4%
log1p-define26.4%
distribute-neg-frac226.4%
neg-sub026.4%
associate--r-26.4%
metadata-eval26.4%
+-commutative26.4%
Simplified26.4%
Taylor expanded in x around 0 8.2%
sub-neg8.2%
metadata-eval8.2%
neg-mul-18.2%
distribute-neg-frac8.2%
Simplified8.2%
Taylor expanded in y around -inf 64.5%
if -2.39999999999999991 < y Initial program 91.8%
sub-neg91.8%
log1p-define91.8%
distribute-neg-frac291.8%
neg-sub091.8%
associate--r-91.8%
metadata-eval91.8%
+-commutative91.8%
Simplified91.8%
Taylor expanded in y around 0 82.4%
log1p-define82.4%
mul-1-neg82.4%
Simplified82.4%
Final simplification77.6%
(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 74.2%
sub-neg74.2%
log1p-define74.2%
distribute-neg-frac274.2%
neg-sub074.2%
associate--r-74.2%
metadata-eval74.2%
+-commutative74.2%
Simplified74.2%
Taylor expanded in y around 0 63.7%
log1p-define63.7%
mul-1-neg63.7%
Simplified63.7%
Final simplification63.7%
(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}
Initial program 74.2%
sub-neg74.2%
log1p-define74.2%
distribute-neg-frac274.2%
neg-sub074.2%
associate--r-74.2%
metadata-eval74.2%
+-commutative74.2%
Simplified74.2%
Taylor expanded in x around 0 39.8%
sub-neg39.8%
metadata-eval39.8%
neg-mul-139.8%
distribute-neg-frac39.8%
Simplified39.8%
Taylor expanded in y around 0 38.6%
Final simplification38.6%
(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 2024084
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, B"
:precision binary64
:alt
(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))))))