\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\]
↓
\[x - \frac{\mathsf{log1p}\left(\mathsf{expm1}\left(z\right) \cdot y\right)}{t}
\]
(FPCore (x y z t)
:precision binary64
(- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))
↓
(FPCore (x y z t) :precision binary64 (- x (/ (log1p (* (expm1 z) y)) 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) {
return x - (log1p((expm1(z) * y)) / t);
}
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) {
return x - (Math.log1p((Math.expm1(z) * y)) / t);
}
def code(x, y, z, t):
return x - (math.log(((1.0 - y) + (y * math.exp(z)))) / t)
↓
def code(x, y, z, t):
return x - (math.log1p((math.expm1(z) * y)) / t)
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)
return Float64(x - Float64(log1p(Float64(expm1(z) * y)) / 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]
↓
code[x_, y_, z_, t_] := N[(x - N[(N[Log[1 + N[(N[(Exp[z] - 1), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
↓
x - \frac{\mathsf{log1p}\left(\mathsf{expm1}\left(z\right) \cdot y\right)}{t}
Alternatives
| Alternative 1 |
|---|
| Error | 1.4 |
|---|
| Cost | 6980 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -3700000000:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(-y\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(z \cdot y\right)}{t}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 4.7 |
|---|
| Cost | 6916 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-11}:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(-y\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \begin{array}{l}
\mathbf{if}\;z \ne 0:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\end{array}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 20.4 |
|---|
| Cost | 1240 |
|---|
\[\begin{array}{l}
t_1 := \frac{-y \cdot z}{t}\\
\mathbf{if}\;x \leq -1.75 \cdot 10^{-66}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -6.6 \cdot 10^{-118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{t} + x\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-162}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{-296}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-208}:\\
\;\;\;\;\frac{-1}{t} \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 20.4 |
|---|
| Cost | 1176 |
|---|
\[\begin{array}{l}
t_1 := \frac{-y \cdot z}{t}\\
\mathbf{if}\;x \leq -1.75 \cdot 10^{-66}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -6.6 \cdot 10^{-118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{t} + x\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-162}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 10^{-296}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-209}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 9.3 |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -850000:\\
\;\;\;\;\frac{y}{t} + x\\
\mathbf{else}:\\
\;\;\;\;x - \begin{array}{l}
\mathbf{if}\;z \ne 0:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\end{array}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 11.6 |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -850000:\\
\;\;\;\;\frac{y}{t} + x\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t} \cdot z\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 9.3 |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -850000:\\
\;\;\;\;\frac{y}{t} + x\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{t} \cdot y\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 16.3 |
|---|
| Cost | 452 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -85000000000000:\\
\;\;\;\;\frac{y}{t} + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 18.2 |
|---|
| Cost | 64 |
|---|
\[x
\]