
(FPCore (x y z t) :precision binary64 (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))
double code(double x, double y, double z, double t) {
return x - (log(((1.0 - y) + (y * exp(z)))) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - (log(((1.0d0 - y) + (y * exp(z)))) / t)
end function
public static double code(double x, double y, double z, double t) {
return x - (Math.log(((1.0 - y) + (y * Math.exp(z)))) / t);
}
def code(x, y, z, t): return x - (math.log(((1.0 - y) + (y * math.exp(z)))) / t)
function code(x, y, z, t) return Float64(x - Float64(log(Float64(Float64(1.0 - y) + Float64(y * exp(z)))) / t)) end
function tmp = code(x, y, z, t) tmp = x - (log(((1.0 - y) + (y * exp(z)))) / t); end
code[x_, y_, z_, t_] := N[(x - N[(N[Log[N[(N[(1.0 - y), $MachinePrecision] + N[(y * N[Exp[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))
double code(double x, double y, double z, double t) {
return x - (log(((1.0 - y) + (y * exp(z)))) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - (log(((1.0d0 - y) + (y * exp(z)))) / t)
end function
public static double code(double x, double y, double z, double t) {
return x - (Math.log(((1.0 - y) + (y * Math.exp(z)))) / t);
}
def code(x, y, z, t): return x - (math.log(((1.0 - y) + (y * math.exp(z)))) / t)
function code(x, y, z, t) return Float64(x - Float64(log(Float64(Float64(1.0 - y) + Float64(y * exp(z)))) / t)) end
function tmp = code(x, y, z, t) tmp = x - (log(((1.0 - y) + (y * exp(z)))) / t); end
code[x_, y_, z_, t_] := N[(x - N[(N[Log[N[(N[(1.0 - y), $MachinePrecision] + N[(y * N[Exp[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (- x (/ (log1p (* y (expm1 z))) t)))
double code(double x, double y, double z, double t) {
return x - (log1p((y * expm1(z))) / t);
}
public static double code(double x, double y, double z, double t) {
return x - (Math.log1p((y * Math.expm1(z))) / t);
}
def code(x, y, z, t): return x - (math.log1p((y * math.expm1(z))) / t)
function code(x, y, z, t) return Float64(x - Float64(log1p(Float64(y * expm1(z))) / t)) end
code[x_, y_, z_, t_] := N[(x - N[(N[Log[1 + N[(y * N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}
\end{array}
Initial program 61.7%
associate-+l-74.9%
sub-neg74.9%
log1p-def82.2%
sub0-neg82.2%
associate-+l-82.2%
neg-sub082.2%
+-commutative82.2%
neg-mul-182.2%
metadata-eval82.2%
cancel-sign-sub-inv82.2%
*-commutative82.2%
distribute-lft-out--82.2%
expm1-def98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 (if (<= (exp z) 1.0) (+ x (/ -1.0 (+ (* t 0.5) (/ t (* y (+ (exp z) -1.0)))))) (- x (/ (log1p (* y (+ z (* 0.5 (* z z))))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (exp(z) <= 1.0) {
tmp = x + (-1.0 / ((t * 0.5) + (t / (y * (exp(z) + -1.0)))));
} else {
tmp = x - (log1p((y * (z + (0.5 * (z * z))))) / t);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (Math.exp(z) <= 1.0) {
tmp = x + (-1.0 / ((t * 0.5) + (t / (y * (Math.exp(z) + -1.0)))));
} else {
tmp = x - (Math.log1p((y * (z + (0.5 * (z * z))))) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if math.exp(z) <= 1.0: tmp = x + (-1.0 / ((t * 0.5) + (t / (y * (math.exp(z) + -1.0))))) else: tmp = x - (math.log1p((y * (z + (0.5 * (z * z))))) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (exp(z) <= 1.0) tmp = Float64(x + Float64(-1.0 / Float64(Float64(t * 0.5) + Float64(t / Float64(y * Float64(exp(z) + -1.0)))))); else tmp = Float64(x - Float64(log1p(Float64(y * Float64(z + Float64(0.5 * Float64(z * z))))) / t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[Exp[z], $MachinePrecision], 1.0], N[(x + N[(-1.0 / N[(N[(t * 0.5), $MachinePrecision] + N[(t / N[(y * N[(N[Exp[z], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[Log[1 + N[(y * N[(z + N[(0.5 * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 1:\\
\;\;\;\;x + \frac{-1}{t \cdot 0.5 + \frac{t}{y \cdot \left(e^{z} + -1\right)}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(y \cdot \left(z + 0.5 \cdot \left(z \cdot z\right)\right)\right)}{t}\\
\end{array}
\end{array}
if (exp.f64 z) < 1Initial program 61.8%
associate-+l-75.2%
sub-neg75.2%
log1p-def82.4%
sub0-neg82.4%
associate-+l-82.4%
neg-sub082.4%
+-commutative82.4%
neg-mul-182.4%
metadata-eval82.4%
cancel-sign-sub-inv82.4%
*-commutative82.4%
distribute-lft-out--82.4%
expm1-def99.2%
Simplified99.2%
expm1-udef82.4%
sub-neg82.4%
distribute-lft-in82.4%
*-commutative82.4%
metadata-eval82.4%
neg-mul-182.4%
sub-neg82.4%
clear-num82.4%
inv-pow82.4%
metadata-eval82.4%
sqr-pow64.5%
Applied egg-rr60.6%
pow-sqr99.1%
metadata-eval99.1%
unpow-199.1%
Simplified99.1%
Taylor expanded in y around 0 78.6%
if 1 < (exp.f64 z) Initial program 51.4%
associate-+l-51.4%
sub-neg51.4%
log1p-def68.4%
sub0-neg68.4%
associate-+l-68.4%
neg-sub068.4%
+-commutative68.4%
neg-mul-168.4%
metadata-eval68.4%
cancel-sign-sub-inv68.4%
*-commutative68.4%
distribute-lft-out--68.3%
expm1-def75.6%
Simplified75.6%
Taylor expanded in z around 0 53.8%
unpow253.8%
Simplified53.8%
Final simplification78.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -0.9)
(+ x (/ -1.0 (+ (/ t (* y z)) (* t (/ -0.5 (/ y (- 1.0 y)))))))
(if (<= y 3.5e+67)
(- x (/ y (/ t (expm1 z))))
(- x (/ (log1p (* y (+ z (* 0.5 (* z z))))) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.9) {
tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y))))));
} else if (y <= 3.5e+67) {
tmp = x - (y / (t / expm1(z)));
} else {
tmp = x - (log1p((y * (z + (0.5 * (z * z))))) / t);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.9) {
tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y))))));
} else if (y <= 3.5e+67) {
tmp = x - (y / (t / Math.expm1(z)));
} else {
tmp = x - (Math.log1p((y * (z + (0.5 * (z * z))))) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -0.9: tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y)))))) elif y <= 3.5e+67: tmp = x - (y / (t / math.expm1(z))) else: tmp = x - (math.log1p((y * (z + (0.5 * (z * z))))) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -0.9) tmp = Float64(x + Float64(-1.0 / Float64(Float64(t / Float64(y * z)) + Float64(t * Float64(-0.5 / Float64(y / Float64(1.0 - y))))))); elseif (y <= 3.5e+67) tmp = Float64(x - Float64(y / Float64(t / expm1(z)))); else tmp = Float64(x - Float64(log1p(Float64(y * Float64(z + Float64(0.5 * Float64(z * z))))) / t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -0.9], N[(x + N[(-1.0 / N[(N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * N[(-0.5 / N[(y / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.5e+67], N[(x - N[(y / N[(t / N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[Log[1 + N[(y * N[(z + N[(0.5 * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.9:\\
\;\;\;\;x + \frac{-1}{\frac{t}{y \cdot z} + t \cdot \frac{-0.5}{\frac{y}{1 - y}}}\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{+67}:\\
\;\;\;\;x - \frac{y}{\frac{t}{\mathsf{expm1}\left(z\right)}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(y \cdot \left(z + 0.5 \cdot \left(z \cdot z\right)\right)\right)}{t}\\
\end{array}
\end{array}
if y < -0.900000000000000022Initial program 48.9%
associate-+l-83.0%
sub-neg83.0%
log1p-def83.0%
sub0-neg83.0%
associate-+l-83.0%
neg-sub083.0%
+-commutative83.0%
neg-mul-183.0%
metadata-eval83.0%
cancel-sign-sub-inv83.0%
*-commutative83.0%
distribute-lft-out--83.0%
expm1-def99.9%
Simplified99.9%
expm1-udef83.0%
sub-neg83.0%
distribute-lft-in83.0%
*-commutative83.0%
metadata-eval83.0%
neg-mul-183.0%
sub-neg83.0%
clear-num82.9%
inv-pow82.9%
metadata-eval82.9%
sqr-pow53.4%
Applied egg-rr36.0%
pow-sqr99.8%
metadata-eval99.8%
unpow-199.8%
Simplified99.8%
Taylor expanded in z around 0 40.0%
fma-def40.0%
associate-/l*43.1%
unpow243.1%
mul-1-neg43.1%
unpow243.1%
Simplified43.1%
fma-udef43.1%
+-commutative43.1%
metadata-eval43.1%
times-frac43.1%
*-commutative43.1%
times-frac43.1%
/-rgt-identity43.1%
associate-/l*76.4%
unsub-neg76.4%
div-sub76.4%
*-inverses76.4%
frac-2neg76.4%
neg-sub076.4%
metadata-eval76.4%
neg-sub076.4%
flip-+80.4%
remove-double-neg80.4%
neg-mul-180.4%
distribute-lft-neg-in80.4%
cancel-sign-sub-inv80.4%
neg-mul-180.4%
neg-sub080.4%
remove-double-neg80.4%
Applied egg-rr80.4%
if -0.900000000000000022 < y < 3.5e67Initial program 76.8%
associate-+l-77.9%
sub-neg77.9%
log1p-def89.3%
sub0-neg89.3%
associate-+l-89.3%
neg-sub089.3%
+-commutative89.3%
neg-mul-189.3%
metadata-eval89.3%
cancel-sign-sub-inv89.3%
*-commutative89.3%
distribute-lft-out--89.3%
expm1-def98.8%
Simplified98.8%
Taylor expanded in y around 0 89.0%
expm1-def98.5%
associate-/l*99.6%
Simplified99.6%
if 3.5e67 < y Initial program 4.8%
associate-+l-41.4%
sub-neg41.4%
log1p-def41.4%
sub0-neg41.4%
associate-+l-41.4%
neg-sub041.4%
+-commutative41.4%
neg-mul-141.4%
metadata-eval41.4%
cancel-sign-sub-inv41.4%
*-commutative41.4%
distribute-lft-out--41.4%
expm1-def96.6%
Simplified96.6%
Taylor expanded in z around 0 94.3%
unpow294.3%
Simplified94.3%
Final simplification94.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -0.2)
(+ x (/ -1.0 (+ (/ t (* y z)) (* t (/ -0.5 (/ y (- 1.0 y)))))))
(if (<= y 9.5e+66)
(- x (/ y (/ t (expm1 z))))
(- x (/ (log1p (* y z)) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.2) {
tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y))))));
} else if (y <= 9.5e+66) {
tmp = x - (y / (t / expm1(z)));
} else {
tmp = x - (log1p((y * z)) / t);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.2) {
tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y))))));
} else if (y <= 9.5e+66) {
tmp = x - (y / (t / Math.expm1(z)));
} else {
tmp = x - (Math.log1p((y * z)) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -0.2: tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y)))))) elif y <= 9.5e+66: tmp = x - (y / (t / math.expm1(z))) else: tmp = x - (math.log1p((y * z)) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -0.2) tmp = Float64(x + Float64(-1.0 / Float64(Float64(t / Float64(y * z)) + Float64(t * Float64(-0.5 / Float64(y / Float64(1.0 - y))))))); elseif (y <= 9.5e+66) tmp = Float64(x - Float64(y / Float64(t / expm1(z)))); else tmp = Float64(x - Float64(log1p(Float64(y * z)) / t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -0.2], N[(x + N[(-1.0 / N[(N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * N[(-0.5 / N[(y / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e+66], N[(x - N[(y / N[(t / N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[Log[1 + N[(y * z), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.2:\\
\;\;\;\;x + \frac{-1}{\frac{t}{y \cdot z} + t \cdot \frac{-0.5}{\frac{y}{1 - y}}}\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{+66}:\\
\;\;\;\;x - \frac{y}{\frac{t}{\mathsf{expm1}\left(z\right)}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(y \cdot z\right)}{t}\\
\end{array}
\end{array}
if y < -0.20000000000000001Initial program 48.9%
associate-+l-83.0%
sub-neg83.0%
log1p-def83.0%
sub0-neg83.0%
associate-+l-83.0%
neg-sub083.0%
+-commutative83.0%
neg-mul-183.0%
metadata-eval83.0%
cancel-sign-sub-inv83.0%
*-commutative83.0%
distribute-lft-out--83.0%
expm1-def99.9%
Simplified99.9%
expm1-udef83.0%
sub-neg83.0%
distribute-lft-in83.0%
*-commutative83.0%
metadata-eval83.0%
neg-mul-183.0%
sub-neg83.0%
clear-num82.9%
inv-pow82.9%
metadata-eval82.9%
sqr-pow53.4%
Applied egg-rr36.0%
pow-sqr99.8%
metadata-eval99.8%
unpow-199.8%
Simplified99.8%
Taylor expanded in z around 0 40.0%
fma-def40.0%
associate-/l*43.1%
unpow243.1%
mul-1-neg43.1%
unpow243.1%
Simplified43.1%
fma-udef43.1%
+-commutative43.1%
metadata-eval43.1%
times-frac43.1%
*-commutative43.1%
times-frac43.1%
/-rgt-identity43.1%
associate-/l*76.4%
unsub-neg76.4%
div-sub76.4%
*-inverses76.4%
frac-2neg76.4%
neg-sub076.4%
metadata-eval76.4%
neg-sub076.4%
flip-+80.4%
remove-double-neg80.4%
neg-mul-180.4%
distribute-lft-neg-in80.4%
cancel-sign-sub-inv80.4%
neg-mul-180.4%
neg-sub080.4%
remove-double-neg80.4%
Applied egg-rr80.4%
if -0.20000000000000001 < y < 9.50000000000000051e66Initial program 76.8%
associate-+l-77.9%
sub-neg77.9%
log1p-def89.3%
sub0-neg89.3%
associate-+l-89.3%
neg-sub089.3%
+-commutative89.3%
neg-mul-189.3%
metadata-eval89.3%
cancel-sign-sub-inv89.3%
*-commutative89.3%
distribute-lft-out--89.3%
expm1-def98.8%
Simplified98.8%
Taylor expanded in y around 0 89.0%
expm1-def98.5%
associate-/l*99.6%
Simplified99.6%
if 9.50000000000000051e66 < y Initial program 4.8%
associate-+l-41.4%
sub-neg41.4%
log1p-def41.4%
sub0-neg41.4%
associate-+l-41.4%
neg-sub041.4%
+-commutative41.4%
neg-mul-141.4%
metadata-eval41.4%
cancel-sign-sub-inv41.4%
*-commutative41.4%
distribute-lft-out--41.4%
expm1-def96.6%
Simplified96.6%
Taylor expanded in z around 0 94.3%
Final simplification94.4%
(FPCore (x y z t) :precision binary64 (if (<= y -1.05) (+ x (/ -1.0 (+ (/ t (* y z)) (* t (/ -0.5 (/ y (- 1.0 y))))))) (- x (/ y (/ t (expm1 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05) {
tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y))))));
} else {
tmp = x - (y / (t / expm1(z)));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05) {
tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y))))));
} else {
tmp = x - (y / (t / Math.expm1(z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.05: tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y)))))) else: tmp = x - (y / (t / math.expm1(z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.05) tmp = Float64(x + Float64(-1.0 / Float64(Float64(t / Float64(y * z)) + Float64(t * Float64(-0.5 / Float64(y / Float64(1.0 - y))))))); else tmp = Float64(x - Float64(y / Float64(t / expm1(z)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.05], N[(x + N[(-1.0 / N[(N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * N[(-0.5 / N[(y / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(t / N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05:\\
\;\;\;\;x + \frac{-1}{\frac{t}{y \cdot z} + t \cdot \frac{-0.5}{\frac{y}{1 - y}}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{t}{\mathsf{expm1}\left(z\right)}}\\
\end{array}
\end{array}
if y < -1.05000000000000004Initial program 48.9%
associate-+l-83.0%
sub-neg83.0%
log1p-def83.0%
sub0-neg83.0%
associate-+l-83.0%
neg-sub083.0%
+-commutative83.0%
neg-mul-183.0%
metadata-eval83.0%
cancel-sign-sub-inv83.0%
*-commutative83.0%
distribute-lft-out--83.0%
expm1-def99.9%
Simplified99.9%
expm1-udef83.0%
sub-neg83.0%
distribute-lft-in83.0%
*-commutative83.0%
metadata-eval83.0%
neg-mul-183.0%
sub-neg83.0%
clear-num82.9%
inv-pow82.9%
metadata-eval82.9%
sqr-pow53.4%
Applied egg-rr36.0%
pow-sqr99.8%
metadata-eval99.8%
unpow-199.8%
Simplified99.8%
Taylor expanded in z around 0 40.0%
fma-def40.0%
associate-/l*43.1%
unpow243.1%
mul-1-neg43.1%
unpow243.1%
Simplified43.1%
fma-udef43.1%
+-commutative43.1%
metadata-eval43.1%
times-frac43.1%
*-commutative43.1%
times-frac43.1%
/-rgt-identity43.1%
associate-/l*76.4%
unsub-neg76.4%
div-sub76.4%
*-inverses76.4%
frac-2neg76.4%
neg-sub076.4%
metadata-eval76.4%
neg-sub076.4%
flip-+80.4%
remove-double-neg80.4%
neg-mul-180.4%
distribute-lft-neg-in80.4%
cancel-sign-sub-inv80.4%
neg-mul-180.4%
neg-sub080.4%
remove-double-neg80.4%
Applied egg-rr80.4%
if -1.05000000000000004 < y Initial program 65.7%
associate-+l-72.3%
sub-neg72.3%
log1p-def82.0%
sub0-neg82.0%
associate-+l-82.0%
neg-sub082.0%
+-commutative82.0%
neg-mul-182.0%
metadata-eval82.0%
cancel-sign-sub-inv82.0%
*-commutative82.0%
distribute-lft-out--81.9%
expm1-def98.4%
Simplified98.4%
Taylor expanded in y around 0 81.2%
expm1-def93.3%
associate-/l*94.5%
Simplified94.5%
Final simplification91.1%
(FPCore (x y z t) :precision binary64 (if (<= y -0.114) (+ x (/ -1.0 (+ (/ t (* y z)) (* t (/ -0.5 (/ y (- 1.0 y))))))) (- x (/ y (+ (* t -0.5) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.114) {
tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y))))));
} else {
tmp = x - (y / ((t * -0.5) + (t / z)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-0.114d0)) then
tmp = x + ((-1.0d0) / ((t / (y * z)) + (t * ((-0.5d0) / (y / (1.0d0 - y))))))
else
tmp = x - (y / ((t * (-0.5d0)) + (t / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -0.114) {
tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y))))));
} else {
tmp = x - (y / ((t * -0.5) + (t / z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -0.114: tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y)))))) else: tmp = x - (y / ((t * -0.5) + (t / z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -0.114) tmp = Float64(x + Float64(-1.0 / Float64(Float64(t / Float64(y * z)) + Float64(t * Float64(-0.5 / Float64(y / Float64(1.0 - y))))))); else tmp = Float64(x - Float64(y / Float64(Float64(t * -0.5) + Float64(t / z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -0.114) tmp = x + (-1.0 / ((t / (y * z)) + (t * (-0.5 / (y / (1.0 - y)))))); else tmp = x - (y / ((t * -0.5) + (t / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -0.114], N[(x + N[(-1.0 / N[(N[(t / N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * N[(-0.5 / N[(y / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(N[(t * -0.5), $MachinePrecision] + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.114:\\
\;\;\;\;x + \frac{-1}{\frac{t}{y \cdot z} + t \cdot \frac{-0.5}{\frac{y}{1 - y}}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t \cdot -0.5 + \frac{t}{z}}\\
\end{array}
\end{array}
if y < -0.114000000000000004Initial program 48.9%
associate-+l-83.0%
sub-neg83.0%
log1p-def83.0%
sub0-neg83.0%
associate-+l-83.0%
neg-sub083.0%
+-commutative83.0%
neg-mul-183.0%
metadata-eval83.0%
cancel-sign-sub-inv83.0%
*-commutative83.0%
distribute-lft-out--83.0%
expm1-def99.9%
Simplified99.9%
expm1-udef83.0%
sub-neg83.0%
distribute-lft-in83.0%
*-commutative83.0%
metadata-eval83.0%
neg-mul-183.0%
sub-neg83.0%
clear-num82.9%
inv-pow82.9%
metadata-eval82.9%
sqr-pow53.4%
Applied egg-rr36.0%
pow-sqr99.8%
metadata-eval99.8%
unpow-199.8%
Simplified99.8%
Taylor expanded in z around 0 40.0%
fma-def40.0%
associate-/l*43.1%
unpow243.1%
mul-1-neg43.1%
unpow243.1%
Simplified43.1%
fma-udef43.1%
+-commutative43.1%
metadata-eval43.1%
times-frac43.1%
*-commutative43.1%
times-frac43.1%
/-rgt-identity43.1%
associate-/l*76.4%
unsub-neg76.4%
div-sub76.4%
*-inverses76.4%
frac-2neg76.4%
neg-sub076.4%
metadata-eval76.4%
neg-sub076.4%
flip-+80.4%
remove-double-neg80.4%
neg-mul-180.4%
distribute-lft-neg-in80.4%
cancel-sign-sub-inv80.4%
neg-mul-180.4%
neg-sub080.4%
remove-double-neg80.4%
Applied egg-rr80.4%
if -0.114000000000000004 < y Initial program 65.7%
associate-+l-72.3%
sub-neg72.3%
log1p-def82.0%
sub0-neg82.0%
associate-+l-82.0%
neg-sub082.0%
+-commutative82.0%
neg-mul-182.0%
metadata-eval82.0%
cancel-sign-sub-inv82.0%
*-commutative82.0%
distribute-lft-out--81.9%
expm1-def98.4%
Simplified98.4%
Taylor expanded in y around 0 81.2%
expm1-def93.3%
associate-/l*94.5%
Simplified94.5%
Taylor expanded in z around 0 86.5%
Final simplification85.0%
(FPCore (x y z t) :precision binary64 (- x (/ (/ -1.0 t) (+ (/ (* 0.5 (- 1.0 y)) y) (/ -1.0 (* y z))))))
double code(double x, double y, double z, double t) {
return x - ((-1.0 / t) / (((0.5 * (1.0 - y)) / y) + (-1.0 / (y * z))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - (((-1.0d0) / t) / (((0.5d0 * (1.0d0 - y)) / y) + ((-1.0d0) / (y * z))))
end function
public static double code(double x, double y, double z, double t) {
return x - ((-1.0 / t) / (((0.5 * (1.0 - y)) / y) + (-1.0 / (y * z))));
}
def code(x, y, z, t): return x - ((-1.0 / t) / (((0.5 * (1.0 - y)) / y) + (-1.0 / (y * z))))
function code(x, y, z, t) return Float64(x - Float64(Float64(-1.0 / t) / Float64(Float64(Float64(0.5 * Float64(1.0 - y)) / y) + Float64(-1.0 / Float64(y * z))))) end
function tmp = code(x, y, z, t) tmp = x - ((-1.0 / t) / (((0.5 * (1.0 - y)) / y) + (-1.0 / (y * z)))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(-1.0 / t), $MachinePrecision] / N[(N[(N[(0.5 * N[(1.0 - y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(-1.0 / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{\frac{-1}{t}}{\frac{0.5 \cdot \left(1 - y\right)}{y} + \frac{-1}{y \cdot z}}
\end{array}
Initial program 61.7%
associate-+l-74.9%
sub-neg74.9%
log1p-def82.2%
sub0-neg82.2%
associate-+l-82.2%
neg-sub082.2%
+-commutative82.2%
neg-mul-182.2%
metadata-eval82.2%
cancel-sign-sub-inv82.2%
*-commutative82.2%
distribute-lft-out--82.2%
expm1-def98.8%
Simplified98.8%
expm1-udef82.2%
sub-neg82.2%
distribute-lft-in82.2%
*-commutative82.2%
metadata-eval82.2%
neg-mul-182.2%
sub-neg82.2%
clear-num82.2%
inv-pow82.2%
metadata-eval82.2%
sqr-pow63.5%
Applied egg-rr59.7%
pow-sqr98.7%
metadata-eval98.7%
unpow-198.7%
Simplified98.7%
Taylor expanded in z around 0 54.7%
fma-def54.7%
associate-/l*62.9%
unpow262.9%
mul-1-neg62.9%
unpow262.9%
Simplified62.9%
fma-udef62.9%
+-commutative62.9%
metadata-eval62.9%
times-frac62.9%
*-commutative62.9%
times-frac62.9%
/-rgt-identity62.9%
associate-/l*78.7%
unsub-neg78.7%
div-sub78.7%
*-inverses78.7%
frac-2neg78.7%
neg-sub078.7%
metadata-eval78.7%
neg-sub078.7%
flip-+81.1%
remove-double-neg81.1%
neg-mul-181.1%
distribute-lft-neg-in81.1%
cancel-sign-sub-inv81.1%
neg-mul-181.1%
neg-sub081.1%
remove-double-neg81.1%
Applied egg-rr81.1%
+-commutative81.1%
fma-def85.0%
associate-/r/85.0%
Simplified85.0%
Taylor expanded in t around -inf 85.0%
associate-/r*85.0%
associate-*r/85.0%
*-commutative85.0%
Simplified85.0%
Final simplification85.0%
(FPCore (x y z t) :precision binary64 (if (<= z -0.55) (- x (/ (* y -2.0) (* t (- 1.0 y)))) (- x (/ y (* t (- (+ (* z 0.08333333333333333) (/ 1.0 z)) 0.5))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.55) {
tmp = x - ((y * -2.0) / (t * (1.0 - y)));
} else {
tmp = x - (y / (t * (((z * 0.08333333333333333) + (1.0 / z)) - 0.5)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-0.55d0)) then
tmp = x - ((y * (-2.0d0)) / (t * (1.0d0 - y)))
else
tmp = x - (y / (t * (((z * 0.08333333333333333d0) + (1.0d0 / z)) - 0.5d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.55) {
tmp = x - ((y * -2.0) / (t * (1.0 - y)));
} else {
tmp = x - (y / (t * (((z * 0.08333333333333333) + (1.0 / z)) - 0.5)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.55: tmp = x - ((y * -2.0) / (t * (1.0 - y))) else: tmp = x - (y / (t * (((z * 0.08333333333333333) + (1.0 / z)) - 0.5))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.55) tmp = Float64(x - Float64(Float64(y * -2.0) / Float64(t * Float64(1.0 - y)))); else tmp = Float64(x - Float64(y / Float64(t * Float64(Float64(Float64(z * 0.08333333333333333) + Float64(1.0 / z)) - 0.5)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.55) tmp = x - ((y * -2.0) / (t * (1.0 - y))); else tmp = x - (y / (t * (((z * 0.08333333333333333) + (1.0 / z)) - 0.5))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.55], N[(x - N[(N[(y * -2.0), $MachinePrecision] / N[(t * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(t * N[(N[(N[(z * 0.08333333333333333), $MachinePrecision] + N[(1.0 / z), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.55:\\
\;\;\;\;x - \frac{y \cdot -2}{t \cdot \left(1 - y\right)}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t \cdot \left(\left(z \cdot 0.08333333333333333 + \frac{1}{z}\right) - 0.5\right)}\\
\end{array}
\end{array}
if z < -0.55000000000000004Initial program 79.3%
associate-+l-79.3%
sub-neg79.3%
log1p-def100.0%
sub0-neg100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
neg-mul-1100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
distribute-lft-out--100.0%
expm1-def100.0%
Simplified100.0%
expm1-udef100.0%
sub-neg100.0%
distribute-lft-in100.0%
*-commutative100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub-neg100.0%
clear-num99.9%
inv-pow99.9%
metadata-eval99.9%
sqr-pow46.9%
Applied egg-rr46.9%
pow-sqr99.9%
metadata-eval99.9%
unpow-199.9%
Simplified99.9%
Taylor expanded in z around 0 46.0%
fma-def46.0%
associate-/l*54.3%
unpow254.3%
mul-1-neg54.3%
unpow254.3%
Simplified54.3%
fma-udef54.3%
+-commutative54.3%
metadata-eval54.3%
times-frac54.3%
*-commutative54.3%
times-frac54.3%
/-rgt-identity54.3%
associate-/l*69.7%
unsub-neg69.7%
div-sub69.7%
*-inverses69.7%
frac-2neg69.7%
neg-sub069.7%
metadata-eval69.7%
neg-sub069.7%
flip-+70.3%
remove-double-neg70.3%
neg-mul-170.3%
distribute-lft-neg-in70.3%
cancel-sign-sub-inv70.3%
neg-mul-170.3%
neg-sub070.3%
remove-double-neg70.3%
Applied egg-rr70.3%
+-commutative70.3%
fma-def70.3%
associate-/r/70.3%
Simplified70.3%
Taylor expanded in z around inf 70.3%
associate-*r/70.3%
*-commutative70.3%
Simplified70.3%
if -0.55000000000000004 < z Initial program 53.2%
associate-+l-72.7%
sub-neg72.7%
log1p-def73.7%
sub0-neg73.7%
associate-+l-73.7%
neg-sub073.7%
+-commutative73.7%
neg-mul-173.7%
metadata-eval73.7%
cancel-sign-sub-inv73.7%
*-commutative73.7%
distribute-lft-out--73.7%
expm1-def98.2%
Simplified98.2%
Taylor expanded in y around 0 73.1%
expm1-def90.4%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in z around 0 91.1%
Taylor expanded in t around 0 91.1%
Final simplification84.4%
(FPCore (x y z t) :precision binary64 (if (<= y -1.9e+194) (- x (/ 2.0 t)) (- x (/ y (+ (* t -0.5) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.9e+194) {
tmp = x - (2.0 / t);
} else {
tmp = x - (y / ((t * -0.5) + (t / z)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.9d+194)) then
tmp = x - (2.0d0 / t)
else
tmp = x - (y / ((t * (-0.5d0)) + (t / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.9e+194) {
tmp = x - (2.0 / t);
} else {
tmp = x - (y / ((t * -0.5) + (t / z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.9e+194: tmp = x - (2.0 / t) else: tmp = x - (y / ((t * -0.5) + (t / z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.9e+194) tmp = Float64(x - Float64(2.0 / t)); else tmp = Float64(x - Float64(y / Float64(Float64(t * -0.5) + Float64(t / z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.9e+194) tmp = x - (2.0 / t); else tmp = x - (y / ((t * -0.5) + (t / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.9e+194], N[(x - N[(2.0 / t), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(N[(t * -0.5), $MachinePrecision] + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+194}:\\
\;\;\;\;x - \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t \cdot -0.5 + \frac{t}{z}}\\
\end{array}
\end{array}
if y < -1.8999999999999999e194Initial program 77.0%
associate-+l-100.0%
sub-neg100.0%
log1p-def100.0%
sub0-neg100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
neg-mul-1100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
distribute-lft-out--100.0%
expm1-def100.0%
Simplified100.0%
expm1-udef100.0%
sub-neg100.0%
distribute-lft-in100.0%
*-commutative100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub-neg100.0%
clear-num100.0%
inv-pow100.0%
metadata-eval100.0%
sqr-pow52.9%
Applied egg-rr35.3%
pow-sqr100.0%
metadata-eval100.0%
unpow-1100.0%
Simplified100.0%
Taylor expanded in z around 0 0.0%
fma-def0.0%
associate-/l*0.0%
unpow20.0%
mul-1-neg0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in y around inf 89.9%
if -1.8999999999999999e194 < y Initial program 60.6%
associate-+l-73.1%
sub-neg73.1%
log1p-def80.9%
sub0-neg80.9%
associate-+l-80.9%
neg-sub080.9%
+-commutative80.9%
neg-mul-180.9%
metadata-eval80.9%
cancel-sign-sub-inv80.9%
*-commutative80.9%
distribute-lft-out--80.9%
expm1-def98.7%
Simplified98.7%
Taylor expanded in y around 0 75.2%
expm1-def88.2%
associate-/l*88.9%
Simplified88.9%
Taylor expanded in z around 0 82.3%
Final simplification82.8%
(FPCore (x y z t) :precision binary64 (if (<= z -0.35) (- x (/ (* y -2.0) (* t (- 1.0 y)))) (- x (/ y (+ (* t -0.5) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.35) {
tmp = x - ((y * -2.0) / (t * (1.0 - y)));
} else {
tmp = x - (y / ((t * -0.5) + (t / z)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-0.35d0)) then
tmp = x - ((y * (-2.0d0)) / (t * (1.0d0 - y)))
else
tmp = x - (y / ((t * (-0.5d0)) + (t / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.35) {
tmp = x - ((y * -2.0) / (t * (1.0 - y)));
} else {
tmp = x - (y / ((t * -0.5) + (t / z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.35: tmp = x - ((y * -2.0) / (t * (1.0 - y))) else: tmp = x - (y / ((t * -0.5) + (t / z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.35) tmp = Float64(x - Float64(Float64(y * -2.0) / Float64(t * Float64(1.0 - y)))); else tmp = Float64(x - Float64(y / Float64(Float64(t * -0.5) + Float64(t / z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.35) tmp = x - ((y * -2.0) / (t * (1.0 - y))); else tmp = x - (y / ((t * -0.5) + (t / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.35], N[(x - N[(N[(y * -2.0), $MachinePrecision] / N[(t * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(N[(t * -0.5), $MachinePrecision] + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.35:\\
\;\;\;\;x - \frac{y \cdot -2}{t \cdot \left(1 - y\right)}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t \cdot -0.5 + \frac{t}{z}}\\
\end{array}
\end{array}
if z < -0.34999999999999998Initial program 79.3%
associate-+l-79.3%
sub-neg79.3%
log1p-def100.0%
sub0-neg100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
neg-mul-1100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
distribute-lft-out--100.0%
expm1-def100.0%
Simplified100.0%
expm1-udef100.0%
sub-neg100.0%
distribute-lft-in100.0%
*-commutative100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub-neg100.0%
clear-num99.9%
inv-pow99.9%
metadata-eval99.9%
sqr-pow46.9%
Applied egg-rr46.9%
pow-sqr99.9%
metadata-eval99.9%
unpow-199.9%
Simplified99.9%
Taylor expanded in z around 0 46.0%
fma-def46.0%
associate-/l*54.3%
unpow254.3%
mul-1-neg54.3%
unpow254.3%
Simplified54.3%
fma-udef54.3%
+-commutative54.3%
metadata-eval54.3%
times-frac54.3%
*-commutative54.3%
times-frac54.3%
/-rgt-identity54.3%
associate-/l*69.7%
unsub-neg69.7%
div-sub69.7%
*-inverses69.7%
frac-2neg69.7%
neg-sub069.7%
metadata-eval69.7%
neg-sub069.7%
flip-+70.3%
remove-double-neg70.3%
neg-mul-170.3%
distribute-lft-neg-in70.3%
cancel-sign-sub-inv70.3%
neg-mul-170.3%
neg-sub070.3%
remove-double-neg70.3%
Applied egg-rr70.3%
+-commutative70.3%
fma-def70.3%
associate-/r/70.3%
Simplified70.3%
Taylor expanded in z around inf 70.3%
associate-*r/70.3%
*-commutative70.3%
Simplified70.3%
if -0.34999999999999998 < z Initial program 53.2%
associate-+l-72.7%
sub-neg72.7%
log1p-def73.7%
sub0-neg73.7%
associate-+l-73.7%
neg-sub073.7%
+-commutative73.7%
neg-mul-173.7%
metadata-eval73.7%
cancel-sign-sub-inv73.7%
*-commutative73.7%
distribute-lft-out--73.7%
expm1-def98.2%
Simplified98.2%
Taylor expanded in y around 0 73.1%
expm1-def90.4%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in z around 0 90.9%
Final simplification84.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1784000000.0) x (- x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1784000000.0) {
tmp = x;
} else {
tmp = x - (z * (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1784000000.0d0)) then
tmp = x
else
tmp = x - (z * (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1784000000.0) {
tmp = x;
} else {
tmp = x - (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1784000000.0: tmp = x else: tmp = x - (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1784000000.0) tmp = x; else tmp = Float64(x - Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1784000000.0) tmp = x; else tmp = x - (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1784000000.0], x, N[(x - N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1784000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -1.784e9Initial program 79.2%
associate-+l-79.2%
sub-neg79.2%
log1p-def100.0%
sub0-neg100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
neg-mul-1100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
distribute-lft-out--100.0%
expm1-def100.0%
Simplified100.0%
Taylor expanded in z around 0 34.2%
associate-/l*31.8%
Simplified31.8%
Taylor expanded in x around inf 66.9%
if -1.784e9 < z Initial program 54.0%
associate-+l-72.9%
sub-neg72.9%
log1p-def74.4%
sub0-neg74.4%
associate-+l-74.4%
neg-sub074.4%
+-commutative74.4%
neg-mul-174.4%
metadata-eval74.4%
cancel-sign-sub-inv74.4%
*-commutative74.4%
distribute-lft-out--74.4%
expm1-def98.3%
Simplified98.3%
Taylor expanded in z around 0 88.4%
associate-/l*89.4%
Simplified89.4%
associate-/r/86.8%
Applied egg-rr86.8%
Final simplification80.8%
(FPCore (x y z t) :precision binary64 (if (<= z -1784000000.0) x (- x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1784000000.0) {
tmp = x;
} else {
tmp = x - (y * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1784000000.0d0)) then
tmp = x
else
tmp = x - (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1784000000.0) {
tmp = x;
} else {
tmp = x - (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1784000000.0: tmp = x else: tmp = x - (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1784000000.0) tmp = x; else tmp = Float64(x - Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1784000000.0) tmp = x; else tmp = x - (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1784000000.0], x, N[(x - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1784000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -1.784e9Initial program 79.2%
associate-+l-79.2%
sub-neg79.2%
log1p-def100.0%
sub0-neg100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
neg-mul-1100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
distribute-lft-out--100.0%
expm1-def100.0%
Simplified100.0%
Taylor expanded in z around 0 34.2%
associate-/l*31.8%
Simplified31.8%
Taylor expanded in x around inf 66.9%
if -1.784e9 < z Initial program 54.0%
associate-+l-72.9%
sub-neg72.9%
log1p-def74.4%
sub0-neg74.4%
associate-+l-74.4%
neg-sub074.4%
+-commutative74.4%
neg-mul-174.4%
metadata-eval74.4%
cancel-sign-sub-inv74.4%
*-commutative74.4%
distribute-lft-out--74.4%
expm1-def98.3%
Simplified98.3%
Taylor expanded in z around 0 88.4%
associate-/l*89.4%
Simplified89.4%
associate-/l*88.4%
*-commutative88.4%
associate-*l/89.6%
Applied egg-rr89.6%
Final simplification82.6%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 61.7%
associate-+l-74.9%
sub-neg74.9%
log1p-def82.2%
sub0-neg82.2%
associate-+l-82.2%
neg-sub082.2%
+-commutative82.2%
neg-mul-182.2%
metadata-eval82.2%
cancel-sign-sub-inv82.2%
*-commutative82.2%
distribute-lft-out--82.2%
expm1-def98.8%
Simplified98.8%
Taylor expanded in z around 0 71.9%
associate-/l*71.9%
Simplified71.9%
Taylor expanded in x around inf 69.9%
Final simplification69.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- 0.5) (* y t))))
(if (< z -2.8874623088207947e+119)
(- (- x (/ t_1 (* z z))) (* t_1 (/ (/ 2.0 z) (* z z))))
(- x (/ (log (+ 1.0 (* z y))) t)))))
double code(double x, double y, double z, double t) {
double t_1 = -0.5 / (y * t);
double tmp;
if (z < -2.8874623088207947e+119) {
tmp = (x - (t_1 / (z * z))) - (t_1 * ((2.0 / z) / (z * z)));
} else {
tmp = x - (log((1.0 + (z * y))) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = -0.5d0 / (y * t)
if (z < (-2.8874623088207947d+119)) then
tmp = (x - (t_1 / (z * z))) - (t_1 * ((2.0d0 / z) / (z * z)))
else
tmp = x - (log((1.0d0 + (z * y))) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -0.5 / (y * t);
double tmp;
if (z < -2.8874623088207947e+119) {
tmp = (x - (t_1 / (z * z))) - (t_1 * ((2.0 / z) / (z * z)));
} else {
tmp = x - (Math.log((1.0 + (z * y))) / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = -0.5 / (y * t) tmp = 0 if z < -2.8874623088207947e+119: tmp = (x - (t_1 / (z * z))) - (t_1 * ((2.0 / z) / (z * z))) else: tmp = x - (math.log((1.0 + (z * y))) / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-0.5) / Float64(y * t)) tmp = 0.0 if (z < -2.8874623088207947e+119) tmp = Float64(Float64(x - Float64(t_1 / Float64(z * z))) - Float64(t_1 * Float64(Float64(2.0 / z) / Float64(z * z)))); else tmp = Float64(x - Float64(log(Float64(1.0 + Float64(z * y))) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -0.5 / (y * t); tmp = 0.0; if (z < -2.8874623088207947e+119) tmp = (x - (t_1 / (z * z))) - (t_1 * ((2.0 / z) / (z * z))); else tmp = x - (log((1.0 + (z * y))) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-0.5) / N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.8874623088207947e+119], N[(N[(x - N[(t$95$1 / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[(N[(2.0 / z), $MachinePrecision] / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[Log[N[(1.0 + N[(z * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-0.5}{y \cdot t}\\
\mathbf{if}\;z < -2.8874623088207947 \cdot 10^{+119}:\\
\;\;\;\;\left(x - \frac{t_1}{z \cdot z}\right) - t_1 \cdot \frac{\frac{2}{z}}{z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\log \left(1 + z \cdot y\right)}{t}\\
\end{array}
\end{array}
herbie shell --seed 2023297
(FPCore (x y z t)
:name "System.Random.MWC.Distributions:truncatedExp from mwc-random-0.13.3.2"
:precision binary64
:herbie-target
(if (< z -2.8874623088207947e+119) (- (- x (/ (/ (- 0.5) (* y t)) (* z z))) (* (/ (- 0.5) (* y t)) (/ (/ 2.0 z) (* z z)))) (- x (/ (log (+ 1.0 (* z y))) t)))
(- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))