
(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 15 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 -13600.0)
(+
1.0
(+
(/ -0.5 (pow y 2.0))
(-
(/ (+ (/ x (- 1.0 x)) (/ -1.0 (- 1.0 x))) y)
(+ (log1p (- x)) (log (/ -1.0 y))))))
(if (<= y 1.25e+34)
(- 1.0 (log1p (/ (- x y) (+ y -1.0))))
(log (* y (exp (- 1.0 (log1p x))))))))
double code(double x, double y) {
double tmp;
if (y <= -13600.0) {
tmp = 1.0 + ((-0.5 / pow(y, 2.0)) + ((((x / (1.0 - x)) + (-1.0 / (1.0 - x))) / y) - (log1p(-x) + log((-1.0 / y)))));
} else if (y <= 1.25e+34) {
tmp = 1.0 - log1p(((x - y) / (y + -1.0)));
} else {
tmp = log((y * exp((1.0 - log1p(x)))));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -13600.0) {
tmp = 1.0 + ((-0.5 / Math.pow(y, 2.0)) + ((((x / (1.0 - x)) + (-1.0 / (1.0 - x))) / y) - (Math.log1p(-x) + Math.log((-1.0 / y)))));
} else if (y <= 1.25e+34) {
tmp = 1.0 - Math.log1p(((x - y) / (y + -1.0)));
} else {
tmp = Math.log((y * Math.exp((1.0 - Math.log1p(x)))));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -13600.0: tmp = 1.0 + ((-0.5 / math.pow(y, 2.0)) + ((((x / (1.0 - x)) + (-1.0 / (1.0 - x))) / y) - (math.log1p(-x) + math.log((-1.0 / y))))) elif y <= 1.25e+34: tmp = 1.0 - math.log1p(((x - y) / (y + -1.0))) else: tmp = math.log((y * math.exp((1.0 - math.log1p(x))))) return tmp
function code(x, y) tmp = 0.0 if (y <= -13600.0) tmp = Float64(1.0 + Float64(Float64(-0.5 / (y ^ 2.0)) + Float64(Float64(Float64(Float64(x / Float64(1.0 - x)) + Float64(-1.0 / Float64(1.0 - x))) / y) - Float64(log1p(Float64(-x)) + log(Float64(-1.0 / y)))))); elseif (y <= 1.25e+34) tmp = Float64(1.0 - log1p(Float64(Float64(x - y) / Float64(y + -1.0)))); else tmp = log(Float64(y * exp(Float64(1.0 - log1p(x))))); end return tmp end
code[x_, y_] := If[LessEqual[y, -13600.0], N[(1.0 + N[(N[(-0.5 / N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(x / N[(1.0 - x), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] - N[(N[Log[1 + (-x)], $MachinePrecision] + N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+34], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Log[N[(y * N[Exp[N[(1.0 - N[Log[1 + x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -13600:\\
\;\;\;\;1 + \left(\frac{-0.5}{{y}^{2}} + \left(\frac{\frac{x}{1 - x} + \frac{-1}{1 - x}}{y} - \left(\mathsf{log1p}\left(-x\right) + \log \left(\frac{-1}{y}\right)\right)\right)\right)\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+34}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot e^{1 - \mathsf{log1p}\left(x\right)}\right)\\
\end{array}
\end{array}
if y < -13600Initial program 18.2%
sub-neg18.2%
log1p-define18.2%
distribute-neg-frac218.2%
neg-sub018.2%
associate--r-18.2%
metadata-eval18.2%
+-commutative18.2%
Simplified18.2%
Taylor expanded in y around -inf 87.5%
Simplified99.6%
if -13600 < y < 1.25e34Initial program 99.9%
sub-neg99.9%
log1p-define100.0%
distribute-neg-frac2100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
if 1.25e34 < y Initial program 45.7%
sub-neg45.7%
log1p-define45.7%
distribute-neg-frac245.7%
neg-sub045.7%
associate--r-45.7%
metadata-eval45.7%
+-commutative45.7%
Simplified45.7%
Taylor expanded in y around -inf 0.0%
associate--r+0.0%
sub-neg0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
+-commutative0.0%
log1p-define0.0%
mul-1-neg0.0%
Simplified0.0%
add-log-exp0.0%
sub-neg0.0%
exp-sum0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
neg-log0.0%
clear-num0.0%
div-inv0.0%
metadata-eval0.0%
add-exp-log0.0%
metadata-eval0.0%
div-inv0.0%
clear-num0.0%
add-sqr-sqrt0.0%
sqrt-unprod41.9%
frac-times38.3%
Applied egg-rr98.8%
Final simplification99.7%
(FPCore (x y)
:precision binary64
(if (<= y -14600.0)
(+
1.0
(- (- (- (/ -1.0 y) (/ 0.5 (pow y 2.0))) (log1p (- x))) (log (/ -1.0 y))))
(if (<= y 3.15e+32)
(- 1.0 (log1p (/ (- x y) (+ y -1.0))))
(log (* y (exp (- 1.0 (log1p x))))))))
double code(double x, double y) {
double tmp;
if (y <= -14600.0) {
tmp = 1.0 + ((((-1.0 / y) - (0.5 / pow(y, 2.0))) - log1p(-x)) - log((-1.0 / y)));
} else if (y <= 3.15e+32) {
tmp = 1.0 - log1p(((x - y) / (y + -1.0)));
} else {
tmp = log((y * exp((1.0 - log1p(x)))));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -14600.0) {
tmp = 1.0 + ((((-1.0 / y) - (0.5 / Math.pow(y, 2.0))) - Math.log1p(-x)) - Math.log((-1.0 / y)));
} else if (y <= 3.15e+32) {
tmp = 1.0 - Math.log1p(((x - y) / (y + -1.0)));
} else {
tmp = Math.log((y * Math.exp((1.0 - Math.log1p(x)))));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -14600.0: tmp = 1.0 + ((((-1.0 / y) - (0.5 / math.pow(y, 2.0))) - math.log1p(-x)) - math.log((-1.0 / y))) elif y <= 3.15e+32: tmp = 1.0 - math.log1p(((x - y) / (y + -1.0))) else: tmp = math.log((y * math.exp((1.0 - math.log1p(x))))) return tmp
function code(x, y) tmp = 0.0 if (y <= -14600.0) tmp = Float64(1.0 + Float64(Float64(Float64(Float64(-1.0 / y) - Float64(0.5 / (y ^ 2.0))) - log1p(Float64(-x))) - log(Float64(-1.0 / y)))); elseif (y <= 3.15e+32) tmp = Float64(1.0 - log1p(Float64(Float64(x - y) / Float64(y + -1.0)))); else tmp = log(Float64(y * exp(Float64(1.0 - log1p(x))))); end return tmp end
code[x_, y_] := If[LessEqual[y, -14600.0], N[(1.0 + N[(N[(N[(N[(-1.0 / y), $MachinePrecision] - N[(0.5 / N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision] - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.15e+32], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Log[N[(y * N[Exp[N[(1.0 - N[Log[1 + x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -14600:\\
\;\;\;\;1 + \left(\left(\left(\frac{-1}{y} - \frac{0.5}{{y}^{2}}\right) - \mathsf{log1p}\left(-x\right)\right) - \log \left(\frac{-1}{y}\right)\right)\\
\mathbf{elif}\;y \leq 3.15 \cdot 10^{+32}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot e^{1 - \mathsf{log1p}\left(x\right)}\right)\\
\end{array}
\end{array}
if y < -14600Initial program 18.2%
sub-neg18.2%
log1p-define18.2%
distribute-neg-frac218.2%
neg-sub018.2%
associate--r-18.2%
metadata-eval18.2%
+-commutative18.2%
Simplified18.2%
Taylor expanded in y around -inf 87.5%
Simplified99.6%
if -14600 < y < 3.1500000000000001e32Initial program 99.9%
sub-neg99.9%
log1p-define100.0%
distribute-neg-frac2100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
if 3.1500000000000001e32 < y Initial program 45.7%
sub-neg45.7%
log1p-define45.7%
distribute-neg-frac245.7%
neg-sub045.7%
associate--r-45.7%
metadata-eval45.7%
+-commutative45.7%
Simplified45.7%
Taylor expanded in y around -inf 0.0%
associate--r+0.0%
sub-neg0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
+-commutative0.0%
log1p-define0.0%
mul-1-neg0.0%
Simplified0.0%
add-log-exp0.0%
sub-neg0.0%
exp-sum0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
neg-log0.0%
clear-num0.0%
div-inv0.0%
metadata-eval0.0%
add-exp-log0.0%
metadata-eval0.0%
div-inv0.0%
clear-num0.0%
add-sqr-sqrt0.0%
sqrt-unprod41.9%
frac-times38.3%
Applied egg-rr98.8%
Final simplification99.7%
(FPCore (x y)
:precision binary64
(if (<= y -520000.0)
(+ 1.0 (- (- (/ -1.0 y) (log1p (- x))) (log (/ -1.0 y))))
(if (<= y 1.62e+33)
(- 1.0 (log1p (/ (- x y) (+ y -1.0))))
(log (* y (exp (- 1.0 (log1p x))))))))
double code(double x, double y) {
double tmp;
if (y <= -520000.0) {
tmp = 1.0 + (((-1.0 / y) - log1p(-x)) - log((-1.0 / y)));
} else if (y <= 1.62e+33) {
tmp = 1.0 - log1p(((x - y) / (y + -1.0)));
} else {
tmp = log((y * exp((1.0 - log1p(x)))));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -520000.0) {
tmp = 1.0 + (((-1.0 / y) - Math.log1p(-x)) - Math.log((-1.0 / y)));
} else if (y <= 1.62e+33) {
tmp = 1.0 - Math.log1p(((x - y) / (y + -1.0)));
} else {
tmp = Math.log((y * Math.exp((1.0 - Math.log1p(x)))));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -520000.0: tmp = 1.0 + (((-1.0 / y) - math.log1p(-x)) - math.log((-1.0 / y))) elif y <= 1.62e+33: tmp = 1.0 - math.log1p(((x - y) / (y + -1.0))) else: tmp = math.log((y * math.exp((1.0 - math.log1p(x))))) return tmp
function code(x, y) tmp = 0.0 if (y <= -520000.0) tmp = Float64(1.0 + Float64(Float64(Float64(-1.0 / y) - log1p(Float64(-x))) - log(Float64(-1.0 / y)))); elseif (y <= 1.62e+33) tmp = Float64(1.0 - log1p(Float64(Float64(x - y) / Float64(y + -1.0)))); else tmp = log(Float64(y * exp(Float64(1.0 - log1p(x))))); end return tmp end
code[x_, y_] := If[LessEqual[y, -520000.0], N[(1.0 + N[(N[(N[(-1.0 / y), $MachinePrecision] - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision] - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.62e+33], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Log[N[(y * N[Exp[N[(1.0 - N[Log[1 + x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -520000:\\
\;\;\;\;1 + \left(\left(\frac{-1}{y} - \mathsf{log1p}\left(-x\right)\right) - \log \left(\frac{-1}{y}\right)\right)\\
\mathbf{elif}\;y \leq 1.62 \cdot 10^{+33}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(y \cdot e^{1 - \mathsf{log1p}\left(x\right)}\right)\\
\end{array}
\end{array}
if y < -5.2e5Initial program 16.5%
sub-neg16.5%
log1p-define16.5%
distribute-neg-frac216.5%
neg-sub016.5%
associate--r-16.5%
metadata-eval16.5%
+-commutative16.5%
Simplified16.5%
Taylor expanded in y around -inf 99.6%
Simplified99.6%
if -5.2e5 < y < 1.62e33Initial program 99.7%
sub-neg99.7%
log1p-define99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
if 1.62e33 < y Initial program 45.7%
sub-neg45.7%
log1p-define45.7%
distribute-neg-frac245.7%
neg-sub045.7%
associate--r-45.7%
metadata-eval45.7%
+-commutative45.7%
Simplified45.7%
Taylor expanded in y around -inf 0.0%
associate--r+0.0%
sub-neg0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
+-commutative0.0%
log1p-define0.0%
mul-1-neg0.0%
Simplified0.0%
add-log-exp0.0%
sub-neg0.0%
exp-sum0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
neg-log0.0%
clear-num0.0%
div-inv0.0%
metadata-eval0.0%
add-exp-log0.0%
metadata-eval0.0%
div-inv0.0%
clear-num0.0%
add-sqr-sqrt0.0%
sqrt-unprod41.9%
frac-times38.3%
Applied egg-rr98.8%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(if (<= y -640000.0)
(+ 1.0 (- (- (/ -1.0 y) (log1p (- x))) (log (/ -1.0 y))))
(if (<= y 9e+34)
(- 1.0 (log1p (/ (- x y) (+ y -1.0))))
(+ (- 1.0 (log1p x)) (log y)))))
double code(double x, double y) {
double tmp;
if (y <= -640000.0) {
tmp = 1.0 + (((-1.0 / y) - log1p(-x)) - log((-1.0 / y)));
} else if (y <= 9e+34) {
tmp = 1.0 - log1p(((x - y) / (y + -1.0)));
} else {
tmp = (1.0 - log1p(x)) + log(y);
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -640000.0) {
tmp = 1.0 + (((-1.0 / y) - Math.log1p(-x)) - Math.log((-1.0 / y)));
} else if (y <= 9e+34) {
tmp = 1.0 - Math.log1p(((x - y) / (y + -1.0)));
} else {
tmp = (1.0 - Math.log1p(x)) + Math.log(y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -640000.0: tmp = 1.0 + (((-1.0 / y) - math.log1p(-x)) - math.log((-1.0 / y))) elif y <= 9e+34: tmp = 1.0 - math.log1p(((x - y) / (y + -1.0))) else: tmp = (1.0 - math.log1p(x)) + math.log(y) return tmp
function code(x, y) tmp = 0.0 if (y <= -640000.0) tmp = Float64(1.0 + Float64(Float64(Float64(-1.0 / y) - log1p(Float64(-x))) - log(Float64(-1.0 / y)))); elseif (y <= 9e+34) tmp = Float64(1.0 - log1p(Float64(Float64(x - y) / Float64(y + -1.0)))); else tmp = Float64(Float64(1.0 - log1p(x)) + log(y)); end return tmp end
code[x_, y_] := If[LessEqual[y, -640000.0], N[(1.0 + N[(N[(N[(-1.0 / y), $MachinePrecision] - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision] - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+34], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[Log[1 + x], $MachinePrecision]), $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -640000:\\
\;\;\;\;1 + \left(\left(\frac{-1}{y} - \mathsf{log1p}\left(-x\right)\right) - \log \left(\frac{-1}{y}\right)\right)\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+34}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \mathsf{log1p}\left(x\right)\right) + \log y\\
\end{array}
\end{array}
if y < -6.4e5Initial program 16.5%
sub-neg16.5%
log1p-define16.5%
distribute-neg-frac216.5%
neg-sub016.5%
associate--r-16.5%
metadata-eval16.5%
+-commutative16.5%
Simplified16.5%
Taylor expanded in y around -inf 99.6%
Simplified99.6%
if -6.4e5 < y < 9.0000000000000001e34Initial program 99.7%
sub-neg99.7%
log1p-define99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
if 9.0000000000000001e34 < y Initial program 45.7%
sub-neg45.7%
log1p-define45.7%
distribute-neg-frac245.7%
neg-sub045.7%
associate--r-45.7%
metadata-eval45.7%
+-commutative45.7%
Simplified45.7%
Taylor expanded in y around -inf 0.0%
associate--r+0.0%
sub-neg0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
+-commutative0.0%
log1p-define0.0%
mul-1-neg0.0%
Simplified0.0%
associate--l-0.0%
sub-neg0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod41.8%
frac-times38.2%
metadata-eval38.2%
metadata-eval38.2%
frac-times41.8%
sqrt-unprod98.6%
add-sqr-sqrt98.6%
log-rec98.6%
Applied egg-rr98.6%
sub-neg98.6%
unsub-neg98.6%
*-rgt-identity98.6%
associate-+l-98.6%
*-rgt-identity98.6%
Simplified98.6%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(if (<= y -4.9e+14)
(- 1.0 (log (/ -1.0 y)))
(if (<= y 8.2e+34)
(- 1.0 (log1p (/ (- x y) (+ y -1.0))))
(+ (- 1.0 (log1p x)) (log y)))))
double code(double x, double y) {
double tmp;
if (y <= -4.9e+14) {
tmp = 1.0 - log((-1.0 / y));
} else if (y <= 8.2e+34) {
tmp = 1.0 - log1p(((x - y) / (y + -1.0)));
} else {
tmp = (1.0 - log1p(x)) + log(y);
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -4.9e+14) {
tmp = 1.0 - Math.log((-1.0 / y));
} else if (y <= 8.2e+34) {
tmp = 1.0 - Math.log1p(((x - y) / (y + -1.0)));
} else {
tmp = (1.0 - Math.log1p(x)) + Math.log(y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.9e+14: tmp = 1.0 - math.log((-1.0 / y)) elif y <= 8.2e+34: tmp = 1.0 - math.log1p(((x - y) / (y + -1.0))) else: tmp = (1.0 - math.log1p(x)) + math.log(y) return tmp
function code(x, y) tmp = 0.0 if (y <= -4.9e+14) tmp = Float64(1.0 - log(Float64(-1.0 / y))); elseif (y <= 8.2e+34) tmp = Float64(1.0 - log1p(Float64(Float64(x - y) / Float64(y + -1.0)))); else tmp = Float64(Float64(1.0 - log1p(x)) + log(y)); end return tmp end
code[x_, y_] := If[LessEqual[y, -4.9e+14], N[(1.0 - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e+34], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[Log[1 + x], $MachinePrecision]), $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.9 \cdot 10^{+14}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+34}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \mathsf{log1p}\left(x\right)\right) + \log y\\
\end{array}
\end{array}
if y < -4.9e14Initial program 14.4%
sub-neg14.4%
log1p-define14.4%
distribute-neg-frac214.4%
neg-sub014.4%
associate--r-14.4%
metadata-eval14.4%
+-commutative14.4%
Simplified14.4%
Taylor expanded in y around -inf 99.6%
associate--r+99.6%
sub-neg99.6%
metadata-eval99.6%
distribute-lft-in99.6%
metadata-eval99.6%
+-commutative99.6%
log1p-define99.6%
mul-1-neg99.6%
Simplified99.6%
Taylor expanded in x around 0 72.6%
if -4.9e14 < y < 8.1999999999999997e34Initial program 99.2%
sub-neg99.2%
log1p-define99.2%
distribute-neg-frac299.2%
neg-sub099.2%
associate--r-99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
if 8.1999999999999997e34 < y Initial program 45.7%
sub-neg45.7%
log1p-define45.7%
distribute-neg-frac245.7%
neg-sub045.7%
associate--r-45.7%
metadata-eval45.7%
+-commutative45.7%
Simplified45.7%
Taylor expanded in y around -inf 0.0%
associate--r+0.0%
sub-neg0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
+-commutative0.0%
log1p-define0.0%
mul-1-neg0.0%
Simplified0.0%
associate--l-0.0%
sub-neg0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod41.8%
frac-times38.2%
metadata-eval38.2%
metadata-eval38.2%
frac-times41.8%
sqrt-unprod98.6%
add-sqr-sqrt98.6%
log-rec98.6%
Applied egg-rr98.6%
sub-neg98.6%
unsub-neg98.6%
*-rgt-identity98.6%
associate-+l-98.6%
*-rgt-identity98.6%
Simplified98.6%
Final simplification91.1%
(FPCore (x y)
:precision binary64
(if (<= y -345000000.0)
(- (- 1.0 (log1p (- x))) (log (/ -1.0 y)))
(if (<= y 2.6e+34)
(- 1.0 (log1p (/ (- x y) (+ y -1.0))))
(+ (- 1.0 (log1p x)) (log y)))))
double code(double x, double y) {
double tmp;
if (y <= -345000000.0) {
tmp = (1.0 - log1p(-x)) - log((-1.0 / y));
} else if (y <= 2.6e+34) {
tmp = 1.0 - log1p(((x - y) / (y + -1.0)));
} else {
tmp = (1.0 - log1p(x)) + log(y);
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -345000000.0) {
tmp = (1.0 - Math.log1p(-x)) - Math.log((-1.0 / y));
} else if (y <= 2.6e+34) {
tmp = 1.0 - Math.log1p(((x - y) / (y + -1.0)));
} else {
tmp = (1.0 - Math.log1p(x)) + Math.log(y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -345000000.0: tmp = (1.0 - math.log1p(-x)) - math.log((-1.0 / y)) elif y <= 2.6e+34: tmp = 1.0 - math.log1p(((x - y) / (y + -1.0))) else: tmp = (1.0 - math.log1p(x)) + math.log(y) return tmp
function code(x, y) tmp = 0.0 if (y <= -345000000.0) tmp = Float64(Float64(1.0 - log1p(Float64(-x))) - log(Float64(-1.0 / y))); elseif (y <= 2.6e+34) tmp = Float64(1.0 - log1p(Float64(Float64(x - y) / Float64(y + -1.0)))); else tmp = Float64(Float64(1.0 - log1p(x)) + log(y)); end return tmp end
code[x_, y_] := If[LessEqual[y, -345000000.0], N[(N[(1.0 - N[Log[1 + (-x)], $MachinePrecision]), $MachinePrecision] - N[Log[N[(-1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+34], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[Log[1 + x], $MachinePrecision]), $MachinePrecision] + N[Log[y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -345000000:\\
\;\;\;\;\left(1 - \mathsf{log1p}\left(-x\right)\right) - \log \left(\frac{-1}{y}\right)\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+34}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \mathsf{log1p}\left(x\right)\right) + \log y\\
\end{array}
\end{array}
if y < -3.45e8Initial program 16.5%
sub-neg16.5%
log1p-define16.5%
distribute-neg-frac216.5%
neg-sub016.5%
associate--r-16.5%
metadata-eval16.5%
+-commutative16.5%
Simplified16.5%
Taylor expanded in y around -inf 99.1%
associate--r+99.1%
sub-neg99.1%
metadata-eval99.1%
distribute-lft-in99.1%
metadata-eval99.1%
+-commutative99.1%
log1p-define99.1%
mul-1-neg99.1%
Simplified99.1%
if -3.45e8 < y < 2.59999999999999997e34Initial program 99.7%
sub-neg99.7%
log1p-define99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
if 2.59999999999999997e34 < y Initial program 45.7%
sub-neg45.7%
log1p-define45.7%
distribute-neg-frac245.7%
neg-sub045.7%
associate--r-45.7%
metadata-eval45.7%
+-commutative45.7%
Simplified45.7%
Taylor expanded in y around -inf 0.0%
associate--r+0.0%
sub-neg0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
+-commutative0.0%
log1p-define0.0%
mul-1-neg0.0%
Simplified0.0%
associate--l-0.0%
sub-neg0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod41.8%
frac-times38.2%
metadata-eval38.2%
metadata-eval38.2%
frac-times41.8%
sqrt-unprod98.6%
add-sqr-sqrt98.6%
log-rec98.6%
Applied egg-rr98.6%
sub-neg98.6%
unsub-neg98.6%
*-rgt-identity98.6%
associate-+l-98.6%
*-rgt-identity98.6%
Simplified98.6%
Final simplification99.4%
(FPCore (x y) :precision binary64 (if (<= (/ (- x y) (- 1.0 y)) 0.99999) (- 1.0 (log1p (* (- x y) (/ 1.0 (+ y -1.0))))) (- 1.0 (log (/ -1.0 y)))))
double code(double x, double y) {
double tmp;
if (((x - y) / (1.0 - y)) <= 0.99999) {
tmp = 1.0 - log1p(((x - y) * (1.0 / (y + -1.0))));
} 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.99999) {
tmp = 1.0 - Math.log1p(((x - y) * (1.0 / (y + -1.0))));
} else {
tmp = 1.0 - Math.log((-1.0 / y));
}
return tmp;
}
def code(x, y): tmp = 0 if ((x - y) / (1.0 - y)) <= 0.99999: tmp = 1.0 - math.log1p(((x - y) * (1.0 / (y + -1.0)))) 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.99999) tmp = Float64(1.0 - log1p(Float64(Float64(x - y) * Float64(1.0 / Float64(y + -1.0))))); 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.99999], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] * N[(1.0 / N[(y + -1.0), $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.99999:\\
\;\;\;\;1 - \mathsf{log1p}\left(\left(x - y\right) \cdot \frac{1}{y + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 x y) (-.f64 1 y)) < 0.999990000000000046Initial 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%
if 0.999990000000000046 < (/.f64 (-.f64 x y) (-.f64 1 y)) Initial program 4.4%
sub-neg4.4%
log1p-define4.4%
distribute-neg-frac24.4%
neg-sub04.4%
associate--r-4.4%
metadata-eval4.4%
+-commutative4.4%
Simplified4.4%
Taylor expanded in y around -inf 81.7%
associate--r+81.7%
sub-neg81.7%
metadata-eval81.7%
distribute-lft-in81.7%
metadata-eval81.7%
+-commutative81.7%
log1p-define81.7%
mul-1-neg81.7%
Simplified81.7%
Taylor expanded in x around 0 67.3%
Final simplification89.0%
(FPCore (x y) :precision binary64 (if (<= (/ (- x y) (- 1.0 y)) 0.99999) (- 1.0 (log1p (/ (- x y) (+ y -1.0)))) (- 1.0 (log (/ -1.0 y)))))
double code(double x, double y) {
double tmp;
if (((x - y) / (1.0 - y)) <= 0.99999) {
tmp = 1.0 - log1p(((x - y) / (y + -1.0)));
} 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.99999) {
tmp = 1.0 - Math.log1p(((x - y) / (y + -1.0)));
} else {
tmp = 1.0 - Math.log((-1.0 / y));
}
return tmp;
}
def code(x, y): tmp = 0 if ((x - y) / (1.0 - y)) <= 0.99999: tmp = 1.0 - math.log1p(((x - y) / (y + -1.0))) 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.99999) tmp = Float64(1.0 - log1p(Float64(Float64(x - y) / Float64(y + -1.0)))); 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.99999], N[(1.0 - N[Log[1 + N[(N[(x - y), $MachinePrecision] / N[(y + -1.0), $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.99999:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x - y}{y + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 x y) (-.f64 1 y)) < 0.999990000000000046Initial 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%
if 0.999990000000000046 < (/.f64 (-.f64 x y) (-.f64 1 y)) Initial program 4.4%
sub-neg4.4%
log1p-define4.4%
distribute-neg-frac24.4%
neg-sub04.4%
associate--r-4.4%
metadata-eval4.4%
+-commutative4.4%
Simplified4.4%
Taylor expanded in y around -inf 81.7%
associate--r+81.7%
sub-neg81.7%
metadata-eval81.7%
distribute-lft-in81.7%
metadata-eval81.7%
+-commutative81.7%
log1p-define81.7%
mul-1-neg81.7%
Simplified81.7%
Taylor expanded in x around 0 67.3%
Final simplification89.0%
(FPCore (x y) :precision binary64 (if (<= y -25.0) (- 1.0 (log (/ -1.0 y))) (- 1.0 (log1p (/ x (+ y -1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -25.0) {
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 <= -25.0) {
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 <= -25.0: 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 <= -25.0) 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, -25.0], 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 -25:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(\frac{x}{y + -1}\right)\\
\end{array}
\end{array}
if y < -25Initial program 20.1%
sub-neg20.1%
log1p-define20.1%
distribute-neg-frac220.1%
neg-sub020.1%
associate--r-20.1%
metadata-eval20.1%
+-commutative20.1%
Simplified20.1%
Taylor expanded in y around -inf 96.2%
associate--r+96.2%
sub-neg96.2%
metadata-eval96.2%
distribute-lft-in96.2%
metadata-eval96.2%
+-commutative96.2%
log1p-define96.2%
mul-1-neg96.2%
Simplified96.2%
Taylor expanded in x around 0 70.3%
if -25 < y Initial program 91.5%
sub-neg91.5%
log1p-define91.5%
distribute-neg-frac291.5%
neg-sub091.5%
associate--r-91.5%
metadata-eval91.5%
+-commutative91.5%
Simplified91.5%
Taylor expanded in x around inf 90.0%
Final simplification83.6%
(FPCore (x y) :precision binary64 (if (<= y -18.0) (- 1.0 (log (/ -1.0 y))) (- 1.0 (+ y (log1p (- x))))))
double code(double x, double y) {
double tmp;
if (y <= -18.0) {
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 <= -18.0) {
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 <= -18.0: 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 <= -18.0) 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, -18.0], 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 -18:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \left(y + \mathsf{log1p}\left(-x\right)\right)\\
\end{array}
\end{array}
if y < -18Initial program 20.1%
sub-neg20.1%
log1p-define20.1%
distribute-neg-frac220.1%
neg-sub020.1%
associate--r-20.1%
metadata-eval20.1%
+-commutative20.1%
Simplified20.1%
Taylor expanded in y around -inf 96.2%
associate--r+96.2%
sub-neg96.2%
metadata-eval96.2%
distribute-lft-in96.2%
metadata-eval96.2%
+-commutative96.2%
log1p-define96.2%
mul-1-neg96.2%
Simplified96.2%
Taylor expanded in x around 0 70.3%
if -18 < y Initial program 91.5%
sub-neg91.5%
log1p-define91.5%
distribute-neg-frac291.5%
neg-sub091.5%
associate--r-91.5%
metadata-eval91.5%
+-commutative91.5%
Simplified91.5%
Taylor expanded in y around 0 80.2%
+-commutative80.2%
div-sub80.2%
*-commutative80.2%
mul-1-neg80.2%
sub-neg80.2%
*-inverses80.2%
metadata-eval80.2%
distribute-lft-neg-in80.2%
neg-mul-180.2%
remove-double-neg80.2%
log1p-define80.2%
mul-1-neg80.2%
Simplified80.2%
Final simplification77.0%
(FPCore (x y) :precision binary64 (if (<= y -14.8) (- 1.0 (log (/ -1.0 y))) (- 1.0 (log1p (- x)))))
double code(double x, double y) {
double tmp;
if (y <= -14.8) {
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 <= -14.8) {
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 <= -14.8: 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 <= -14.8) 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, -14.8], 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 -14.8:\\
\;\;\;\;1 - \log \left(\frac{-1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \mathsf{log1p}\left(-x\right)\\
\end{array}
\end{array}
if y < -14.800000000000001Initial program 20.1%
sub-neg20.1%
log1p-define20.1%
distribute-neg-frac220.1%
neg-sub020.1%
associate--r-20.1%
metadata-eval20.1%
+-commutative20.1%
Simplified20.1%
Taylor expanded in y around -inf 96.2%
associate--r+96.2%
sub-neg96.2%
metadata-eval96.2%
distribute-lft-in96.2%
metadata-eval96.2%
+-commutative96.2%
log1p-define96.2%
mul-1-neg96.2%
Simplified96.2%
Taylor expanded in x around 0 70.3%
if -14.800000000000001 < y Initial program 91.5%
sub-neg91.5%
log1p-define91.5%
distribute-neg-frac291.5%
neg-sub091.5%
associate--r-91.5%
metadata-eval91.5%
+-commutative91.5%
Simplified91.5%
Taylor expanded in y around 0 79.3%
log1p-define79.3%
mul-1-neg79.3%
Simplified79.3%
Final simplification76.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 68.0%
sub-neg68.0%
log1p-define68.1%
distribute-neg-frac268.1%
neg-sub068.1%
associate--r-68.1%
metadata-eval68.1%
+-commutative68.1%
Simplified68.1%
Taylor expanded in y around 0 57.4%
log1p-define57.4%
mul-1-neg57.4%
Simplified57.4%
Final simplification57.4%
(FPCore (x y) :precision binary64 (- (+ 1.0 x) y))
double code(double x, double y) {
return (1.0 + x) - y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 + x) - y
end function
public static double code(double x, double y) {
return (1.0 + x) - y;
}
def code(x, y): return (1.0 + x) - y
function code(x, y) return Float64(Float64(1.0 + x) - y) end
function tmp = code(x, y) tmp = (1.0 + x) - y; end
code[x_, y_] := N[(N[(1.0 + x), $MachinePrecision] - y), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + x\right) - y
\end{array}
Initial program 68.0%
sub-neg68.0%
log1p-define68.1%
distribute-neg-frac268.1%
neg-sub068.1%
associate--r-68.1%
metadata-eval68.1%
+-commutative68.1%
Simplified68.1%
Taylor expanded in y around 0 55.5%
+-commutative55.5%
div-sub55.5%
*-commutative55.5%
mul-1-neg55.5%
sub-neg55.5%
*-inverses55.5%
metadata-eval55.5%
distribute-lft-neg-in55.5%
neg-mul-155.5%
remove-double-neg55.5%
log1p-define55.5%
mul-1-neg55.5%
Simplified55.5%
Taylor expanded in x around 0 38.6%
Final simplification38.6%
(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 68.0%
sub-neg68.0%
log1p-define68.1%
distribute-neg-frac268.1%
neg-sub068.1%
associate--r-68.1%
metadata-eval68.1%
+-commutative68.1%
Simplified68.1%
Taylor expanded in y around 0 55.5%
+-commutative55.5%
div-sub55.5%
*-commutative55.5%
mul-1-neg55.5%
sub-neg55.5%
*-inverses55.5%
metadata-eval55.5%
distribute-lft-neg-in55.5%
neg-mul-155.5%
remove-double-neg55.5%
log1p-define55.5%
mul-1-neg55.5%
Simplified55.5%
Taylor expanded in x around 0 37.9%
Final simplification37.9%
(FPCore (x y) :precision binary64 (- y))
double code(double x, double y) {
return -y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = -y
end function
public static double code(double x, double y) {
return -y;
}
def code(x, y): return -y
function code(x, y) return Float64(-y) end
function tmp = code(x, y) tmp = -y; end
code[x_, y_] := (-y)
\begin{array}{l}
\\
-y
\end{array}
Initial program 68.0%
sub-neg68.0%
log1p-define68.1%
distribute-neg-frac268.1%
neg-sub068.1%
associate--r-68.1%
metadata-eval68.1%
+-commutative68.1%
Simplified68.1%
Taylor expanded in y around 0 55.5%
+-commutative55.5%
div-sub55.5%
*-commutative55.5%
mul-1-neg55.5%
sub-neg55.5%
*-inverses55.5%
metadata-eval55.5%
distribute-lft-neg-in55.5%
neg-mul-155.5%
remove-double-neg55.5%
log1p-define55.5%
mul-1-neg55.5%
Simplified55.5%
Taylor expanded in y around inf 4.2%
neg-mul-14.2%
Simplified4.2%
Final simplification4.2%
(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 2024067
(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))))))