\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-155} \lor \neg \left(y \leq 9.6 \cdot 10^{-53}\right):\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{\mathsf{expm1}\left(z\right)}{t}\\
\end{array}
\]
(FPCore (x y z t)
:precision binary64
(- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))
↓
(FPCore (x y z t)
:precision binary64
(if (or (<= y -5e-155) (not (<= y 9.6e-53)))
(- x (/ (log1p (* y (expm1 z))) t))
(- x (* y (/ (expm1 z) t)))))
double code(double x, double y, double z, double t) {
return x - (log(((1.0 - y) + (y * exp(z)))) / t);
}
↓
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5e-155) || !(y <= 9.6e-53)) {
tmp = x - (log1p((y * expm1(z))) / t);
} else {
tmp = x - (y * (expm1(z) / t));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
return x - (Math.log(((1.0 - y) + (y * Math.exp(z)))) / t);
}
↓
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5e-155) || !(y <= 9.6e-53)) {
tmp = x - (Math.log1p((y * Math.expm1(z))) / t);
} else {
tmp = x - (y * (Math.expm1(z) / t));
}
return tmp;
}
def code(x, y, z, t):
return x - (math.log(((1.0 - y) + (y * math.exp(z)))) / t)
↓
def code(x, y, z, t):
tmp = 0
if (y <= -5e-155) or not (y <= 9.6e-53):
tmp = x - (math.log1p((y * math.expm1(z))) / t)
else:
tmp = x - (y * (math.expm1(z) / t))
return tmp
function code(x, y, z, t)
return Float64(x - Float64(log(Float64(Float64(1.0 - y) + Float64(y * exp(z)))) / t))
end
↓
function code(x, y, z, t)
tmp = 0.0
if ((y <= -5e-155) || !(y <= 9.6e-53))
tmp = Float64(x - Float64(log1p(Float64(y * expm1(z))) / t));
else
tmp = Float64(x - Float64(y * Float64(expm1(z) / t)));
end
return tmp
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]
↓
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5e-155], N[Not[LessEqual[y, 9.6e-53]], $MachinePrecision]], N[(x - N[(N[Log[1 + N[(y * N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(N[(Exp[z] - 1), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
↓
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-155} \lor \neg \left(y \leq 9.6 \cdot 10^{-53}\right):\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{\mathsf{expm1}\left(z\right)}{t}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 4.2 |
|---|
| Cost | 7364 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -8.6 \cdot 10^{+28}:\\
\;\;\;\;x + \frac{-1}{t \cdot \left(0.5 + \frac{1}{y \cdot \mathsf{expm1}\left(z\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(y \cdot z\right)}{t}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 4.2 |
|---|
| Cost | 7364 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -8.6 \cdot 10^{+28}:\\
\;\;\;\;x + \frac{-1}{\frac{t}{y \cdot \mathsf{expm1}\left(z\right)} + t \cdot 0.5}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(y \cdot z\right)}{t}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 5.1 |
|---|
| Cost | 7113 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+66} \lor \neg \left(y \leq 400000\right):\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(y \cdot z\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{\mathsf{expm1}\left(z\right)}{t}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 7.2 |
|---|
| Cost | 6980 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -380000000000:\\
\;\;\;\;x + \frac{-1}{t \cdot 0.5 + \frac{\frac{t}{z}}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{\mathsf{expm1}\left(z\right)}{t}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 9.5 |
|---|
| Cost | 1220 |
|---|
\[\begin{array}{l}
t_1 := \frac{\frac{t}{z}}{y}\\
\mathbf{if}\;z \leq -8.6 \cdot 10^{+28}:\\
\;\;\;\;x + \frac{-1}{t_1 + 0.5 \cdot \left(t - \frac{t}{y}\right)}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-1}{t \cdot 0.5 + t_1}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 19.0 |
|---|
| Cost | 913 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{-160}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.05 \cdot 10^{-211} \lor \neg \left(t \leq -4 \cdot 10^{-252}\right) \land t \leq 1.8 \cdot 10^{-271}:\\
\;\;\;\;y \cdot \frac{-z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 19.1 |
|---|
| Cost | 913 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{-159}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.15 \cdot 10^{-211} \lor \neg \left(t \leq -2.1 \cdot 10^{-257}\right) \land t \leq 10^{-271}:\\
\;\;\;\;\frac{-y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 11.7 |
|---|
| Cost | 832 |
|---|
\[x + \frac{-1}{t \cdot 0.5 + \frac{\frac{t}{z}}{y}}
\]
| Alternative 9 |
|---|
| Error | 18.9 |
|---|
| Cost | 648 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \leq -2.35 \cdot 10^{-160}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.2 \cdot 10^{-211}:\\
\;\;\;\;z \cdot \frac{-y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 14.0 |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{+40}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \frac{y}{t}\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 11.7 |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -6.7 \cdot 10^{+39}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{t}\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 11.7 |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+40}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{t}{z}}\\
\end{array}
\]
| Alternative 13 |
|---|
| Error | 18.2 |
|---|
| Cost | 64 |
|---|
\[x
\]