\[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\]
↓
\[\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(x + -1\right)\right) - t
\]
(FPCore (x y z t)
:precision binary64
(- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
↓
(FPCore (x y z t)
:precision binary64
(- (fma (+ z -1.0) (log1p (- y)) (* (log y) (+ x -1.0))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
↓
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), (log(y) * (x + -1.0))) - t;
}
function code(x, y, z, t)
return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t)
end
↓
function code(x, y, z, t)
return Float64(fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(log(y) * Float64(x + -1.0))) - t)
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
↓
code[x_, y_, z_, t_] := N[(N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
↓
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(x + -1\right)\right) - t
Alternatives
| Alternative 1 |
|---|
| Error | 4.48% |
|---|
| Cost | 7497 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x + -1 \leq -1000 \lor \neg \left(x + -1 \leq 10^{+19}\right):\\
\;\;\;\;\log y \cdot \left(x + -1\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y - z \cdot y\right) - \log y\right) - t\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 12.31% |
|---|
| Cost | 7241 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x + -1 \leq -1.000001 \lor \neg \left(x + -1 \leq -0.96\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;-\left(\log y + t\right)\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.91% |
|---|
| Cost | 7232 |
|---|
\[\left(\log y \cdot \left(x + -1\right) + y \cdot \left(1 - z\right)\right) - t
\]
| Alternative 4 |
|---|
| Error | 35.88% |
|---|
| Cost | 7120 |
|---|
\[\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := y \cdot \left(1 - z\right) - t\\
\mathbf{if}\;x \leq -1250:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{-291}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 2.35 \cdot 10^{-251}:\\
\;\;\;\;-\log y\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+19}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 9.53% |
|---|
| Cost | 7113 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+228} \lor \neg \left(z \leq 1.3 \cdot 10^{+196}\right):\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(x + -1\right) - t\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 47.41% |
|---|
| Cost | 7056 |
|---|
\[\begin{array}{l}
t_1 := -\log y\\
t_2 := y \cdot \left(1 - z\right) - t\\
\mathbf{if}\;t \leq -3.6 \cdot 10^{-102}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{-212}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{-153}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 1.8 \cdot 10^{-28}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - z \cdot y\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 23.89% |
|---|
| Cost | 6921 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -6.6 \cdot 10^{+40} \lor \neg \left(x \leq 1800000000000\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;-\left(\log y + t\right)\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 24.05% |
|---|
| Cost | 6920 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -210:\\
\;\;\;\;\log y \cdot \left(x + -1\right)\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+16}:\\
\;\;\;\;-\left(\log y + t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log y\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 54.44% |
|---|
| Cost | 448 |
|---|
\[y \cdot \left(1 - z\right) - t
\]
| Alternative 10 |
|---|
| Error | 54.64% |
|---|
| Cost | 384 |
|---|
\[\left(-t\right) - z \cdot y
\]
| Alternative 11 |
|---|
| Error | 64.37% |
|---|
| Cost | 128 |
|---|
\[-t
\]
| Alternative 12 |
|---|
| Error | 97.76% |
|---|
| Cost | 64 |
|---|
\[t
\]