Math FPCore C Julia Wolfram TeX \[\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), \left(x + -1\right) \cdot \log y - t\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)) (- (* (+ x -1.0) (log y)) 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), (((x + -1.0) * log(y)) - 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)), Float64(Float64(Float64(x + -1.0) * log(y)) - 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[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $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), \left(x + -1\right) \cdot \log y - t\right)
Alternatives Alternative 1 Accuracy 99.8% Cost 19968
\[\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y - t\right)
\]
Alternative 2 Accuracy 99.8% Cost 19968
\[\mathsf{log1p}\left(-y\right) \cdot \left(z + -1\right) - \mathsf{fma}\left(\log y, 1 - x, t\right)
\]
Alternative 3 Accuracy 95.9% Cost 7561
\[\begin{array}{l}
\mathbf{if}\;x + -1 \leq -1.000001 \lor \neg \left(x + -1 \leq -1\right):\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\left(-z\right) - -1\right) - \left(\log y + t\right)\\
\end{array}
\]
Alternative 4 Accuracy 74.2% Cost 7448
\[\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \left(-t\right) - \log y\\
t_3 := y \cdot \left(\left(-z\right) - -1\right) - t\\
\mathbf{if}\;x \leq -4.5 \cdot 10^{+115}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{+46}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -2.15 \cdot 10^{+30}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -5.6 \cdot 10^{-160}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{-228}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+73}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 5 Accuracy 94.8% Cost 7240
\[\begin{array}{l}
t_1 := \left(x + -1\right) \cdot \log y\\
\mathbf{if}\;t \leq -2.2 \cdot 10^{+49}:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-18}:\\
\;\;\;\;t_1 - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;t_1 - t\\
\end{array}
\]
Alternative 6 Accuracy 99.2% Cost 7232
\[\left(\left(x + -1\right) \cdot \log y - y \cdot \left(z + -1\right)\right) - t
\]
Alternative 7 Accuracy 90.3% Cost 7177
\[\begin{array}{l}
\mathbf{if}\;z \leq -9.6 \cdot 10^{+250} \lor \neg \left(z \leq 2.2 \cdot 10^{+212}\right):\\
\;\;\;\;\mathsf{log1p}\left(-y\right) \cdot \left(z + -1\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\end{array}
\]
Alternative 8 Accuracy 65.2% Cost 7120
\[\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \left(\left(\left(z + -1\right) \cdot -0.5\right) \cdot \left(y \cdot y\right) - y \cdot \left(z + -1\right)\right) - t\\
\mathbf{if}\;x \leq -1.75 \cdot 10^{+115}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{-289}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{-269}:\\
\;\;\;\;-\log y\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+69}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 9 Accuracy 90.2% Cost 7113
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+251} \lor \neg \left(z \leq 4.4 \cdot 10^{+212}\right):\\
\;\;\;\;\left(\left(\left(z + -1\right) \cdot -0.5\right) \cdot \left(y \cdot y\right) - y \cdot \left(z + -1\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\end{array}
\]
Alternative 10 Accuracy 86.8% Cost 6985
\[\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{+21} \lor \neg \left(t \leq 1.05 \cdot 10^{-14}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y\\
\end{array}
\]
Alternative 11 Accuracy 78.3% Cost 6984
\[\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{+47}:\\
\;\;\;\;y \cdot \left(\left(-z\right) - -1\right) - t\\
\mathbf{elif}\;t \leq 5000000:\\
\;\;\;\;\left(x + -1\right) \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(z + -1\right) \cdot -0.5\right) \cdot \left(y \cdot y\right) - y \cdot \left(z + -1\right)\right) - t\\
\end{array}
\]
Alternative 12 Accuracy 51.5% Cost 6793
\[\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{-65} \lor \neg \left(t \leq 3.6 \cdot 10^{-240}\right):\\
\;\;\;\;\left(\left(\left(z + -1\right) \cdot -0.5\right) \cdot \left(y \cdot y\right) - y \cdot \left(z + -1\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;-\log y\\
\end{array}
\]
Alternative 13 Accuracy 46.1% Cost 1088
\[\left(\left(\left(z + -1\right) \cdot -0.5\right) \cdot \left(y \cdot y\right) - y \cdot \left(z + -1\right)\right) - t
\]
Alternative 14 Accuracy 42.7% Cost 584
\[\begin{array}{l}
\mathbf{if}\;t \leq -6.6 \cdot 10^{+27}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 2020000000000:\\
\;\;\;\;y - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\]
Alternative 15 Accuracy 42.4% Cost 520
\[\begin{array}{l}
\mathbf{if}\;t \leq -8.5 \cdot 10^{+27}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 2020000000000:\\
\;\;\;\;z \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\]
Alternative 16 Accuracy 45.8% Cost 512
\[y \cdot \left(\left(-z\right) - -1\right) - t
\]
Alternative 17 Accuracy 35.3% Cost 128
\[-t
\]