
(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 12 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.1%
associate-+l-74.1%
sub-neg74.1%
log1p-define80.9%
neg-sub080.9%
associate-+l-80.9%
neg-sub080.9%
+-commutative80.9%
unsub-neg80.9%
*-rgt-identity80.9%
distribute-lft-out--80.9%
expm1-define97.7%
Simplified97.7%
(FPCore (x y z t)
:precision binary64
(if (<= y -8.6e+61)
(+
x
(/
-1.0
(/
(+
(* 0.5 (* y t))
(/ t (* z (+ 1.0 (* z (+ 0.5 (* z 0.16666666666666666)))))))
y)))
(if (<= y 2.15e-14)
(- x (/ y (/ t (expm1 z))))
(- x (/ (log1p (* z (+ y (* 0.5 (* y z))))) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.6e+61) {
tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y));
} else if (y <= 2.15e-14) {
tmp = x - (y / (t / expm1(z)));
} else {
tmp = x - (log1p((z * (y + (0.5 * (y * z))))) / t);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.6e+61) {
tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y));
} else if (y <= 2.15e-14) {
tmp = x - (y / (t / Math.expm1(z)));
} else {
tmp = x - (Math.log1p((z * (y + (0.5 * (y * z))))) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.6e+61: tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y)) elif y <= 2.15e-14: tmp = x - (y / (t / math.expm1(z))) else: tmp = x - (math.log1p((z * (y + (0.5 * (y * z))))) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.6e+61) tmp = Float64(x + Float64(-1.0 / Float64(Float64(Float64(0.5 * Float64(y * t)) + Float64(t / Float64(z * Float64(1.0 + Float64(z * Float64(0.5 + Float64(z * 0.16666666666666666))))))) / y))); elseif (y <= 2.15e-14) tmp = Float64(x - Float64(y / Float64(t / expm1(z)))); else tmp = Float64(x - Float64(log1p(Float64(z * Float64(y + Float64(0.5 * Float64(y * z))))) / t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.6e+61], N[(x + N[(-1.0 / N[(N[(N[(0.5 * N[(y * t), $MachinePrecision]), $MachinePrecision] + N[(t / N[(z * N[(1.0 + N[(z * N[(0.5 + N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.15e-14], N[(x - N[(y / N[(t / N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[Log[1 + N[(z * N[(y + N[(0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{+61}:\\
\;\;\;\;x + \frac{-1}{\frac{0.5 \cdot \left(y \cdot t\right) + \frac{t}{z \cdot \left(1 + z \cdot \left(0.5 + z \cdot 0.16666666666666666\right)\right)}}{y}}\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{-14}:\\
\;\;\;\;x - \frac{y}{\frac{t}{\mathsf{expm1}\left(z\right)}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(z \cdot \left(y + 0.5 \cdot \left(y \cdot z\right)\right)\right)}{t}\\
\end{array}
\end{array}
if y < -8.6000000000000003e61Initial program 54.3%
associate-+l-82.1%
sub-neg82.1%
log1p-define82.1%
neg-sub082.1%
associate-+l-82.1%
neg-sub082.1%
+-commutative82.1%
unsub-neg82.1%
*-rgt-identity82.1%
distribute-lft-out--82.1%
expm1-define99.7%
Simplified99.7%
clear-num99.7%
associate-/r/99.8%
Applied egg-rr99.8%
associate-*l/99.7%
*-un-lft-identity99.7%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 55.7%
Taylor expanded in y around 0 77.6%
if -8.6000000000000003e61 < y < 2.14999999999999999e-14Initial program 75.9%
associate-+l-77.1%
sub-neg77.1%
log1p-define87.5%
neg-sub087.5%
associate-+l-87.5%
neg-sub087.5%
+-commutative87.5%
unsub-neg87.5%
*-rgt-identity87.5%
distribute-lft-out--87.5%
expm1-define96.7%
Simplified96.7%
Taylor expanded in y around 0 84.1%
associate-/l*84.1%
expm1-define95.7%
Simplified95.7%
clear-num95.7%
un-div-inv95.8%
Applied egg-rr95.8%
if 2.14999999999999999e-14 < y Initial program 11.1%
associate-+l-54.5%
sub-neg54.5%
log1p-define54.5%
neg-sub054.5%
associate-+l-54.5%
neg-sub054.5%
+-commutative54.5%
unsub-neg54.5%
*-rgt-identity54.5%
distribute-lft-out--54.5%
expm1-define99.9%
Simplified99.9%
Taylor expanded in z around 0 98.1%
Final simplification93.1%
(FPCore (x y z t)
:precision binary64
(if (<= y -9.5e+61)
(+
x
(/
-1.0
(/
(+
(* 0.5 (* y t))
(/ t (* z (+ 1.0 (* z (+ 0.5 (* z 0.16666666666666666)))))))
y)))
(if (<= y 1.1e+252)
(- x (/ y (/ t (expm1 z))))
(/ (log1p (* z (+ y (* 0.5 (* y z))))) (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.5e+61) {
tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y));
} else if (y <= 1.1e+252) {
tmp = x - (y / (t / expm1(z)));
} else {
tmp = log1p((z * (y + (0.5 * (y * z))))) / -t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.5e+61) {
tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y));
} else if (y <= 1.1e+252) {
tmp = x - (y / (t / Math.expm1(z)));
} else {
tmp = Math.log1p((z * (y + (0.5 * (y * z))))) / -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -9.5e+61: tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y)) elif y <= 1.1e+252: tmp = x - (y / (t / math.expm1(z))) else: tmp = math.log1p((z * (y + (0.5 * (y * z))))) / -t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -9.5e+61) tmp = Float64(x + Float64(-1.0 / Float64(Float64(Float64(0.5 * Float64(y * t)) + Float64(t / Float64(z * Float64(1.0 + Float64(z * Float64(0.5 + Float64(z * 0.16666666666666666))))))) / y))); elseif (y <= 1.1e+252) tmp = Float64(x - Float64(y / Float64(t / expm1(z)))); else tmp = Float64(log1p(Float64(z * Float64(y + Float64(0.5 * Float64(y * z))))) / Float64(-t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -9.5e+61], N[(x + N[(-1.0 / N[(N[(N[(0.5 * N[(y * t), $MachinePrecision]), $MachinePrecision] + N[(t / N[(z * N[(1.0 + N[(z * N[(0.5 + N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e+252], N[(x - N[(y / N[(t / N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[1 + N[(z * N[(y + N[(0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+61}:\\
\;\;\;\;x + \frac{-1}{\frac{0.5 \cdot \left(y \cdot t\right) + \frac{t}{z \cdot \left(1 + z \cdot \left(0.5 + z \cdot 0.16666666666666666\right)\right)}}{y}}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+252}:\\
\;\;\;\;x - \frac{y}{\frac{t}{\mathsf{expm1}\left(z\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(z \cdot \left(y + 0.5 \cdot \left(y \cdot z\right)\right)\right)}{-t}\\
\end{array}
\end{array}
if y < -9.49999999999999959e61Initial program 54.3%
associate-+l-82.1%
sub-neg82.1%
log1p-define82.1%
neg-sub082.1%
associate-+l-82.1%
neg-sub082.1%
+-commutative82.1%
unsub-neg82.1%
*-rgt-identity82.1%
distribute-lft-out--82.1%
expm1-define99.7%
Simplified99.7%
clear-num99.7%
associate-/r/99.8%
Applied egg-rr99.8%
associate-*l/99.7%
*-un-lft-identity99.7%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 55.7%
Taylor expanded in y around 0 77.6%
if -9.49999999999999959e61 < y < 1.1e252Initial program 64.3%
associate-+l-74.4%
sub-neg74.4%
log1p-define82.9%
neg-sub082.9%
associate-+l-82.9%
neg-sub082.9%
+-commutative82.9%
unsub-neg82.9%
*-rgt-identity82.9%
distribute-lft-out--82.9%
expm1-define97.3%
Simplified97.3%
Taylor expanded in y around 0 79.3%
associate-/l*79.3%
expm1-define93.7%
Simplified93.7%
clear-num93.6%
un-div-inv93.7%
Applied egg-rr93.7%
if 1.1e252 < y Initial program 0.3%
associate-+l-3.7%
sub-neg3.7%
log1p-define3.7%
neg-sub03.7%
associate-+l-3.7%
neg-sub03.7%
+-commutative3.7%
unsub-neg3.7%
*-rgt-identity3.7%
distribute-lft-out--3.7%
expm1-define99.5%
Simplified99.5%
Taylor expanded in x around 0 2.3%
mul-1-neg2.3%
log1p-define2.3%
expm1-define99.2%
distribute-frac-neg299.2%
Simplified99.2%
Taylor expanded in z around 0 99.2%
Final simplification91.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -75000000.0)
(+ x (/ 1.0 (/ (- (/ t (- 1.0 (exp z))) (* 0.5 (* y t))) y)))
(-
x
(/ (log1p (* z (+ y (* y (* z (+ 0.5 (* z 0.16666666666666666))))))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -75000000.0) {
tmp = x + (1.0 / (((t / (1.0 - exp(z))) - (0.5 * (y * t))) / y));
} else {
tmp = x - (log1p((z * (y + (y * (z * (0.5 + (z * 0.16666666666666666))))))) / t);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -75000000.0) {
tmp = x + (1.0 / (((t / (1.0 - Math.exp(z))) - (0.5 * (y * t))) / y));
} else {
tmp = x - (Math.log1p((z * (y + (y * (z * (0.5 + (z * 0.16666666666666666))))))) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -75000000.0: tmp = x + (1.0 / (((t / (1.0 - math.exp(z))) - (0.5 * (y * t))) / y)) else: tmp = x - (math.log1p((z * (y + (y * (z * (0.5 + (z * 0.16666666666666666))))))) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -75000000.0) tmp = Float64(x + Float64(1.0 / Float64(Float64(Float64(t / Float64(1.0 - exp(z))) - Float64(0.5 * Float64(y * t))) / y))); else tmp = Float64(x - Float64(log1p(Float64(z * Float64(y + Float64(y * Float64(z * Float64(0.5 + Float64(z * 0.16666666666666666))))))) / t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -75000000.0], N[(x + N[(1.0 / N[(N[(N[(t / N[(1.0 - N[Exp[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[Log[1 + N[(z * N[(y + N[(y * N[(z * N[(0.5 + N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -75000000:\\
\;\;\;\;x + \frac{1}{\frac{\frac{t}{1 - e^{z}} - 0.5 \cdot \left(y \cdot t\right)}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(z \cdot \left(y + y \cdot \left(z \cdot \left(0.5 + z \cdot 0.16666666666666666\right)\right)\right)\right)}{t}\\
\end{array}
\end{array}
if z < -7.5e7Initial program 77.6%
associate-+l-77.6%
sub-neg77.6%
log1p-define99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
*-rgt-identity99.9%
distribute-lft-out--99.9%
expm1-define99.9%
Simplified99.9%
clear-num99.7%
associate-/r/99.8%
Applied egg-rr99.8%
associate-*l/99.9%
*-un-lft-identity99.9%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 83.7%
if -7.5e7 < z Initial program 53.7%
associate-+l-72.5%
sub-neg72.5%
log1p-define72.5%
neg-sub072.5%
associate-+l-72.5%
neg-sub072.5%
+-commutative72.5%
unsub-neg72.5%
*-rgt-identity72.5%
distribute-lft-out--72.5%
expm1-define96.8%
Simplified96.8%
clear-num96.8%
associate-/r/96.8%
Applied egg-rr96.8%
associate-*l/96.8%
*-un-lft-identity96.8%
clear-num96.8%
Applied egg-rr96.8%
Taylor expanded in z around 0 96.5%
Taylor expanded in t around 0 78.4%
log1p-define96.6%
distribute-rgt-in96.6%
*-commutative96.6%
associate-*r*96.6%
*-commutative96.6%
+-commutative96.6%
associate-*l*96.6%
distribute-lft-in96.6%
associate-*r*96.6%
*-commutative96.6%
Simplified96.6%
Final simplification92.6%
(FPCore (x y z t) :precision binary64 (if (<= z -0.13) (+ x (/ 1.0 (/ (- (/ t (- 1.0 (exp z))) (* 0.5 (* y t))) y))) (- x (/ (log1p (* z (+ y (* 0.5 (* y z))))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.13) {
tmp = x + (1.0 / (((t / (1.0 - exp(z))) - (0.5 * (y * t))) / y));
} else {
tmp = x - (log1p((z * (y + (0.5 * (y * z))))) / t);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.13) {
tmp = x + (1.0 / (((t / (1.0 - Math.exp(z))) - (0.5 * (y * t))) / y));
} else {
tmp = x - (Math.log1p((z * (y + (0.5 * (y * z))))) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.13: tmp = x + (1.0 / (((t / (1.0 - math.exp(z))) - (0.5 * (y * t))) / y)) else: tmp = x - (math.log1p((z * (y + (0.5 * (y * z))))) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.13) tmp = Float64(x + Float64(1.0 / Float64(Float64(Float64(t / Float64(1.0 - exp(z))) - Float64(0.5 * Float64(y * t))) / y))); else tmp = Float64(x - Float64(log1p(Float64(z * Float64(y + Float64(0.5 * Float64(y * z))))) / t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.13], N[(x + N[(1.0 / N[(N[(N[(t / N[(1.0 - N[Exp[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[Log[1 + N[(z * N[(y + N[(0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.13:\\
\;\;\;\;x + \frac{1}{\frac{\frac{t}{1 - e^{z}} - 0.5 \cdot \left(y \cdot t\right)}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(z \cdot \left(y + 0.5 \cdot \left(y \cdot z\right)\right)\right)}{t}\\
\end{array}
\end{array}
if z < -0.13Initial program 78.7%
associate-+l-78.7%
sub-neg78.7%
log1p-define99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
*-rgt-identity99.9%
distribute-lft-out--99.9%
expm1-define99.9%
Simplified99.9%
clear-num99.7%
associate-/r/99.8%
Applied egg-rr99.8%
associate-*l/99.9%
*-un-lft-identity99.9%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 83.4%
if -0.13 < z Initial program 52.7%
associate-+l-71.9%
sub-neg71.9%
log1p-define71.9%
neg-sub071.9%
associate-+l-71.9%
neg-sub071.9%
+-commutative71.9%
unsub-neg71.9%
*-rgt-identity71.9%
distribute-lft-out--71.9%
expm1-define96.7%
Simplified96.7%
Taylor expanded in z around 0 96.8%
Final simplification92.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -8.5e+61)
(+
x
(/
-1.0
(/
(+
(* 0.5 (* y t))
(/ t (* z (+ 1.0 (* z (+ 0.5 (* z 0.16666666666666666)))))))
y)))
(- x (/ y (/ t (expm1 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.5e+61) {
tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / 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 <= -8.5e+61) {
tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y));
} else {
tmp = x - (y / (t / Math.expm1(z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.5e+61: tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y)) else: tmp = x - (y / (t / math.expm1(z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.5e+61) tmp = Float64(x + Float64(-1.0 / Float64(Float64(Float64(0.5 * Float64(y * t)) + Float64(t / Float64(z * Float64(1.0 + Float64(z * Float64(0.5 + Float64(z * 0.16666666666666666))))))) / y))); else tmp = Float64(x - Float64(y / Float64(t / expm1(z)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.5e+61], N[(x + N[(-1.0 / N[(N[(N[(0.5 * N[(y * t), $MachinePrecision]), $MachinePrecision] + N[(t / N[(z * N[(1.0 + N[(z * N[(0.5 + N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $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 -8.5 \cdot 10^{+61}:\\
\;\;\;\;x + \frac{-1}{\frac{0.5 \cdot \left(y \cdot t\right) + \frac{t}{z \cdot \left(1 + z \cdot \left(0.5 + z \cdot 0.16666666666666666\right)\right)}}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{t}{\mathsf{expm1}\left(z\right)}}\\
\end{array}
\end{array}
if y < -8.50000000000000035e61Initial program 54.3%
associate-+l-82.1%
sub-neg82.1%
log1p-define82.1%
neg-sub082.1%
associate-+l-82.1%
neg-sub082.1%
+-commutative82.1%
unsub-neg82.1%
*-rgt-identity82.1%
distribute-lft-out--82.1%
expm1-define99.7%
Simplified99.7%
clear-num99.7%
associate-/r/99.8%
Applied egg-rr99.8%
associate-*l/99.7%
*-un-lft-identity99.7%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 55.7%
Taylor expanded in y around 0 77.6%
if -8.50000000000000035e61 < y Initial program 62.5%
associate-+l-72.4%
sub-neg72.4%
log1p-define80.7%
neg-sub080.7%
associate-+l-80.7%
neg-sub080.7%
+-commutative80.7%
unsub-neg80.7%
*-rgt-identity80.7%
distribute-lft-out--80.7%
expm1-define97.3%
Simplified97.3%
Taylor expanded in y around 0 77.2%
associate-/l*77.1%
expm1-define91.2%
Simplified91.2%
clear-num91.2%
un-div-inv91.2%
Applied egg-rr91.2%
Final simplification88.9%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.65e+62)
(+
x
(/
-1.0
(/
(+
(* 0.5 (* y t))
(/ t (* z (+ 1.0 (* z (+ 0.5 (* z 0.16666666666666666)))))))
y)))
(- x (* y (/ (expm1 z) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.65e+62) {
tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y));
} else {
tmp = x - (y * (expm1(z) / t));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.65e+62) {
tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y));
} else {
tmp = x - (y * (Math.expm1(z) / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.65e+62: tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y)) else: tmp = x - (y * (math.expm1(z) / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.65e+62) tmp = Float64(x + Float64(-1.0 / Float64(Float64(Float64(0.5 * Float64(y * t)) + Float64(t / Float64(z * Float64(1.0 + Float64(z * Float64(0.5 + Float64(z * 0.16666666666666666))))))) / y))); else tmp = Float64(x - Float64(y * Float64(expm1(z) / t))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.65e+62], N[(x + N[(-1.0 / N[(N[(N[(0.5 * N[(y * t), $MachinePrecision]), $MachinePrecision] + N[(t / N[(z * N[(1.0 + N[(z * N[(0.5 + N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(N[(Exp[z] - 1), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+62}:\\
\;\;\;\;x + \frac{-1}{\frac{0.5 \cdot \left(y \cdot t\right) + \frac{t}{z \cdot \left(1 + z \cdot \left(0.5 + z \cdot 0.16666666666666666\right)\right)}}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{\mathsf{expm1}\left(z\right)}{t}\\
\end{array}
\end{array}
if y < -1.65e62Initial program 54.3%
associate-+l-82.1%
sub-neg82.1%
log1p-define82.1%
neg-sub082.1%
associate-+l-82.1%
neg-sub082.1%
+-commutative82.1%
unsub-neg82.1%
*-rgt-identity82.1%
distribute-lft-out--82.1%
expm1-define99.7%
Simplified99.7%
clear-num99.7%
associate-/r/99.8%
Applied egg-rr99.8%
associate-*l/99.7%
*-un-lft-identity99.7%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 55.7%
Taylor expanded in y around 0 77.6%
if -1.65e62 < y Initial program 62.5%
associate-+l-72.4%
sub-neg72.4%
log1p-define80.7%
neg-sub080.7%
associate-+l-80.7%
neg-sub080.7%
+-commutative80.7%
unsub-neg80.7%
*-rgt-identity80.7%
distribute-lft-out--80.7%
expm1-define97.3%
Simplified97.3%
Taylor expanded in y around 0 77.2%
associate-/l*77.1%
expm1-define91.2%
Simplified91.2%
Final simplification88.9%
(FPCore (x y z t)
:precision binary64
(if (<= z -4e+65)
x
(+
x
(/
-1.0
(/
(+
(* 0.5 (* y t))
(/ t (* z (+ 1.0 (* z (+ 0.5 (* z 0.16666666666666666)))))))
y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+65) {
tmp = x;
} else {
tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y));
}
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 <= (-4d+65)) then
tmp = x
else
tmp = x + ((-1.0d0) / (((0.5d0 * (y * t)) + (t / (z * (1.0d0 + (z * (0.5d0 + (z * 0.16666666666666666d0))))))) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+65) {
tmp = x;
} else {
tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4e+65: tmp = x else: tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4e+65) tmp = x; else tmp = Float64(x + Float64(-1.0 / Float64(Float64(Float64(0.5 * Float64(y * t)) + Float64(t / Float64(z * Float64(1.0 + Float64(z * Float64(0.5 + Float64(z * 0.16666666666666666))))))) / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4e+65) tmp = x; else tmp = x + (-1.0 / (((0.5 * (y * t)) + (t / (z * (1.0 + (z * (0.5 + (z * 0.16666666666666666))))))) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4e+65], x, N[(x + N[(-1.0 / N[(N[(N[(0.5 * N[(y * t), $MachinePrecision]), $MachinePrecision] + N[(t / N[(z * N[(1.0 + N[(z * N[(0.5 + N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+65}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-1}{\frac{0.5 \cdot \left(y \cdot t\right) + \frac{t}{z \cdot \left(1 + z \cdot \left(0.5 + z \cdot 0.16666666666666666\right)\right)}}{y}}\\
\end{array}
\end{array}
if z < -4e65Initial program 76.8%
associate-+l-76.8%
sub-neg76.8%
log1p-define99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
*-rgt-identity99.9%
distribute-lft-out--99.9%
expm1-define99.9%
Simplified99.9%
Taylor expanded in x around inf 58.2%
if -4e65 < z Initial program 55.8%
associate-+l-73.1%
sub-neg73.1%
log1p-define74.5%
neg-sub074.5%
associate-+l-74.5%
neg-sub074.5%
+-commutative74.5%
unsub-neg74.5%
*-rgt-identity74.5%
distribute-lft-out--74.5%
expm1-define97.0%
Simplified97.0%
clear-num97.0%
associate-/r/97.0%
Applied egg-rr97.0%
associate-*l/97.0%
*-un-lft-identity97.0%
clear-num97.0%
Applied egg-rr97.0%
Taylor expanded in z around 0 92.4%
Taylor expanded in y around 0 89.7%
Final simplification81.7%
(FPCore (x y z t)
:precision binary64
(if (<= t -7.5e-183)
x
(if (or (<= t 3.5e-297) (and (not (<= t 4.8e-280)) (<= t 4.1e-153)))
(* y (/ z (- t)))
x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.5e-183) {
tmp = x;
} else if ((t <= 3.5e-297) || (!(t <= 4.8e-280) && (t <= 4.1e-153))) {
tmp = y * (z / -t);
} else {
tmp = x;
}
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 (t <= (-7.5d-183)) then
tmp = x
else if ((t <= 3.5d-297) .or. (.not. (t <= 4.8d-280)) .and. (t <= 4.1d-153)) then
tmp = y * (z / -t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.5e-183) {
tmp = x;
} else if ((t <= 3.5e-297) || (!(t <= 4.8e-280) && (t <= 4.1e-153))) {
tmp = y * (z / -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7.5e-183: tmp = x elif (t <= 3.5e-297) or (not (t <= 4.8e-280) and (t <= 4.1e-153)): tmp = y * (z / -t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7.5e-183) tmp = x; elseif ((t <= 3.5e-297) || (!(t <= 4.8e-280) && (t <= 4.1e-153))) tmp = Float64(y * Float64(z / Float64(-t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7.5e-183) tmp = x; elseif ((t <= 3.5e-297) || (~((t <= 4.8e-280)) && (t <= 4.1e-153))) tmp = y * (z / -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7.5e-183], x, If[Or[LessEqual[t, 3.5e-297], And[N[Not[LessEqual[t, 4.8e-280]], $MachinePrecision], LessEqual[t, 4.1e-153]]], N[(y * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{-183}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{-297} \lor \neg \left(t \leq 4.8 \cdot 10^{-280}\right) \land t \leq 4.1 \cdot 10^{-153}:\\
\;\;\;\;y \cdot \frac{z}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -7.5000000000000004e-183 or 3.4999999999999999e-297 < t < 4.7999999999999996e-280 or 4.1e-153 < t Initial program 69.3%
associate-+l-84.9%
sub-neg84.9%
log1p-define89.7%
neg-sub089.7%
associate-+l-89.7%
neg-sub089.7%
+-commutative89.7%
unsub-neg89.7%
*-rgt-identity89.7%
distribute-lft-out--89.7%
expm1-define99.0%
Simplified99.0%
Taylor expanded in x around inf 79.8%
if -7.5000000000000004e-183 < t < 3.4999999999999999e-297 or 4.7999999999999996e-280 < t < 4.1e-153Initial program 28.8%
associate-+l-31.6%
sub-neg31.6%
log1p-define46.4%
neg-sub046.4%
associate-+l-46.4%
neg-sub046.4%
+-commutative46.4%
unsub-neg46.4%
*-rgt-identity46.4%
distribute-lft-out--46.4%
expm1-define92.8%
Simplified92.8%
Taylor expanded in x around 0 15.7%
mul-1-neg15.7%
log1p-define30.4%
expm1-define76.2%
distribute-frac-neg276.2%
Simplified76.2%
Taylor expanded in z around 0 44.0%
mul-1-neg44.0%
associate-*r/50.8%
distribute-lft-neg-in50.8%
Simplified50.8%
Final simplification73.9%
(FPCore (x y z t) :precision binary64 (if (<= z -0.42) x (- x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.42) {
tmp = x;
} else {
tmp = x - (y / (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.42d0)) then
tmp = x
else
tmp = x - (y / (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.42) {
tmp = x;
} else {
tmp = x - (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.42: tmp = x else: tmp = x - (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.42) tmp = x; else tmp = Float64(x - Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.42) tmp = x; else tmp = x - (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.42], x, N[(x - N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.42:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if z < -0.419999999999999984Initial program 78.7%
associate-+l-78.7%
sub-neg78.7%
log1p-define99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
*-rgt-identity99.9%
distribute-lft-out--99.9%
expm1-define99.9%
Simplified99.9%
Taylor expanded in x around inf 59.4%
if -0.419999999999999984 < z Initial program 52.7%
associate-+l-71.9%
sub-neg71.9%
log1p-define71.9%
neg-sub071.9%
associate-+l-71.9%
neg-sub071.9%
+-commutative71.9%
unsub-neg71.9%
*-rgt-identity71.9%
distribute-lft-out--71.9%
expm1-define96.7%
Simplified96.7%
Taylor expanded in z around 0 89.2%
associate-/l*91.8%
Simplified91.8%
clear-num91.8%
un-div-inv91.8%
Applied egg-rr91.8%
(FPCore (x y z t) :precision binary64 (if (<= z -3.6) x (- x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.6) {
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 <= (-3.6d0)) 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 <= -3.6) {
tmp = x;
} else {
tmp = x - (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.6: tmp = x else: tmp = x - (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.6) 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 <= -3.6) tmp = x; else tmp = x - (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.6], x, N[(x - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -3.60000000000000009Initial program 78.7%
associate-+l-78.7%
sub-neg78.7%
log1p-define99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
*-rgt-identity99.9%
distribute-lft-out--99.9%
expm1-define99.9%
Simplified99.9%
Taylor expanded in x around inf 59.4%
if -3.60000000000000009 < z Initial program 52.7%
associate-+l-71.9%
sub-neg71.9%
log1p-define71.9%
neg-sub071.9%
associate-+l-71.9%
neg-sub071.9%
+-commutative71.9%
unsub-neg71.9%
*-rgt-identity71.9%
distribute-lft-out--71.9%
expm1-define96.7%
Simplified96.7%
Taylor expanded in z around 0 89.2%
associate-/l*91.8%
Simplified91.8%
(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.1%
associate-+l-74.1%
sub-neg74.1%
log1p-define80.9%
neg-sub080.9%
associate-+l-80.9%
neg-sub080.9%
+-commutative80.9%
unsub-neg80.9%
*-rgt-identity80.9%
distribute-lft-out--80.9%
expm1-define97.7%
Simplified97.7%
Taylor expanded in x around inf 67.4%
(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 2024096
(FPCore (x y z t)
:name "System.Random.MWC.Distributions:truncatedExp from mwc-random-0.13.3.2"
:precision binary64
:alt
(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)))