\[\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), \mathsf{fma}\left(\log y, x + -1, -t\right)\right)
\]
(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)) (fma (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), fma(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 fma(Float64(z + -1.0), log1p(Float64(-y)), fma(log(y), Float64(x + -1.0), Float64(-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[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + (-t)), $MachinePrecision]), $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), \mathsf{fma}\left(\log y, x + -1, -t\right)\right)
Alternatives
| Alternative 1 |
|---|
| Error | 0.1 |
|---|
| Cost | 13696 |
|---|
\[\left(\left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) - \left(1 - x\right) \cdot \log y\right) - t
\]
| Alternative 2 |
|---|
| Error | 2.9 |
|---|
| Cost | 7368 |
|---|
\[\begin{array}{l}
t_1 := \left(x - 1\right) \cdot \log y\\
\mathbf{if}\;t \leq -28:\\
\;\;\;\;t_1 - t\\
\mathbf{elif}\;t \leq 35000:\\
\;\;\;\;t_1 - \left(z - 1\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot x - t\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.6 |
|---|
| Cost | 7232 |
|---|
\[\left(\left(x + -1\right) \cdot \log y - y \cdot \left(z + -1\right)\right) - t
\]
| Alternative 4 |
|---|
| Error | 6.8 |
|---|
| Cost | 7108 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{+225}:\\
\;\;\;\;\left(-y \cdot z\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y + \left(x - 1\right) \cdot \log y\right) - t\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 14.8 |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
t_1 := \log y \cdot x - t\\
\mathbf{if}\;x \leq -4.7 \cdot 10^{+14}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 175000:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 7.9 |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
t_1 := \log y \cdot x - t\\
\mathbf{if}\;x \leq -1550:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-6}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 6.9 |
|---|
| Cost | 6980 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+233}:\\
\;\;\;\;\left(-y \cdot z\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(x - 1\right) \cdot \log y - t\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 22.0 |
|---|
| Cost | 6856 |
|---|
\[\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -5.5 \cdot 10^{+80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 17000000000:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 36.7 |
|---|
| Cost | 520 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \leq -0.009:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 1800000000000:\\
\;\;\;\;-y \cdot z\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 34.6 |
|---|
| Cost | 448 |
|---|
\[y \cdot \left(1 - z\right) - t
\]
| Alternative 11 |
|---|
| Error | 34.8 |
|---|
| Cost | 384 |
|---|
\[\left(-y \cdot z\right) - t
\]
| Alternative 12 |
|---|
| Error | 41.0 |
|---|
| Cost | 192 |
|---|
\[y - t
\]
| Alternative 13 |
|---|
| Error | 41.1 |
|---|
| Cost | 128 |
|---|
\[-t
\]