\[x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
\]
↓
\[x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\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 (* 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) {
return x - (log1p((y * expm1(z))) / 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((y * Math.expm1(z))) / 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((y * math.expm1(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 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[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[(y * N[(Exp[z] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
↓
x - \frac{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(z\right)\right)}{t}
Alternatives
| Alternative 1 |
|---|
| Error | 4.5 |
|---|
| Cost | 13448 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -173.48997110354924:\\
\;\;\;\;x - \frac{1}{t \cdot 0.5 + \frac{t}{\left(1 + z \cdot 0.5\right) \cdot \left(y \cdot z\right)}}\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+24}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{expm1}\left(z\right), \frac{-y}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(z \cdot \left(y + y \cdot \left(z \cdot 0.5\right)\right)\right)}{t}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 4.5 |
|---|
| Cost | 7496 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -173.48997110354924:\\
\;\;\;\;x - \frac{1}{t \cdot 0.5 + \frac{t}{\left(1 + z \cdot 0.5\right) \cdot \left(y \cdot z\right)}}\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+24}:\\
\;\;\;\;x - \frac{\mathsf{expm1}\left(z\right)}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{log1p}\left(z \cdot \left(y + y \cdot \left(z \cdot 0.5\right)\right)\right)}{t}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 7.8 |
|---|
| Cost | 6980 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -173.48997110354924:\\
\;\;\;\;x - \frac{1}{t \cdot 0.5 + \frac{t}{\left(1 + z \cdot 0.5\right) \cdot \left(y \cdot z\right)}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{expm1}\left(z\right)}{\frac{t}{y}}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 11.3 |
|---|
| Cost | 1480 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+26}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5.680952625312589 \cdot 10^{-233}:\\
\;\;\;\;x - y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{1}{t \cdot 0.5 + \frac{t}{\left(1 + z \cdot 0.5\right) \cdot \left(y \cdot z\right)}}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 19.0 |
|---|
| Cost | 648 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.3865486965715162 \cdot 10^{-282}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.8516088628711375 \cdot 10^{-173}:\\
\;\;\;\;z \cdot \frac{-y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 11.8 |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+26}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{t}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 18.2 |
|---|
| Cost | 64 |
|---|
\[x
\]