\[\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\]
↓
\[\left(\left(\mathsf{log1p}\left(-y\right) \cdot \left(-1 + z\right) - t\right) + \log y \cdot x\right) + \left(-\log y\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
(+ (+ (- (* (log1p (- y)) (+ -1.0 z)) t) (* (log y) x)) (- (log y))))
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 (((log1p(-y) * (-1.0 + z)) - t) + (log(y) * x)) + -log(y);
}
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
↓
public static double code(double x, double y, double z, double t) {
return (((Math.log1p(-y) * (-1.0 + z)) - t) + (Math.log(y) * x)) + -Math.log(y);
}
def code(x, y, z, t):
return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
↓
def code(x, y, z, t):
return (((math.log1p(-y) * (-1.0 + z)) - t) + (math.log(y) * x)) + -math.log(y)
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(Float64(Float64(Float64(log1p(Float64(-y)) * Float64(-1.0 + z)) - t) + Float64(log(y) * x)) + Float64(-log(y)))
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[(N[(N[Log[1 + (-y)], $MachinePrecision] * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] + (-N[Log[y], $MachinePrecision])), $MachinePrecision]
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
↓
\left(\left(\mathsf{log1p}\left(-y\right) \cdot \left(-1 + z\right) - t\right) + \log y \cdot x\right) + \left(-\log y\right)
Alternatives
| Alternative 1 |
|---|
| Error | 0.1 |
|---|
| Cost | 19968 |
|---|
\[\mathsf{fma}\left(\log y, -1 + x, \mathsf{log1p}\left(-y\right) \cdot \left(-1 + z\right) - t\right)
\]
| Alternative 2 |
|---|
| Error | 0.3 |
|---|
| Cost | 13892 |
|---|
\[\begin{array}{l}
t_1 := \left(x - 1\right) \cdot \log y\\
\mathbf{if}\;y \leq 4.2 \cdot 10^{-9}:\\
\;\;\;\;\left(t_1 + \left(1 - z\right) \cdot y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 4.2 |
|---|
| Cost | 7368 |
|---|
\[\begin{array}{l}
t_1 := \left(\log y \cdot x + \left(1 - z\right) \cdot y\right) - t\\
\mathbf{if}\;z \leq -3.4 \cdot 10^{+148}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+268}:\\
\;\;\;\;\left(x - 1\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 8.2 |
|---|
| Cost | 7240 |
|---|
\[\begin{array}{l}
t_1 := \log y \cdot x - t\\
\mathbf{if}\;x - 1 \leq -500000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x - 1 \leq -0.999999999:\\
\;\;\;\;\left(-t\right) + \left(-\log y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.6 |
|---|
| Cost | 7232 |
|---|
\[\left(\left(x - 1\right) \cdot \log y + \left(1 - z\right) \cdot y\right) - t
\]
| Alternative 6 |
|---|
| Error | 21.7 |
|---|
| Cost | 7120 |
|---|
\[\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -4.9 \cdot 10^{+45}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+32}:\\
\;\;\;\;\left(y - y \cdot z\right) - t\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+48}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+110}:\\
\;\;\;\;\left(-y \cdot z\right) - t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 14.4 |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
t_1 := \left(-y \cdot z\right) - t\\
\mathbf{if}\;t \leq -8.6 \cdot 10^{+95}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 5.6 \cdot 10^{+18}:\\
\;\;\;\;\left(x - 1\right) \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 7.0 |
|---|
| Cost | 6980 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -3.25 \cdot 10^{+246}:\\
\;\;\;\;\left(-y \cdot z\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(x - 1\right) \cdot \log y - t\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 37.2 |
|---|
| Cost | 520 |
|---|
\[\begin{array}{l}
\mathbf{if}\;t \leq -265000000000:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{+43}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 34.6 |
|---|
| Cost | 448 |
|---|
\[\left(y - y \cdot z\right) - t
\]
| Alternative 11 |
|---|
| Error | 34.7 |
|---|
| Cost | 384 |
|---|
\[\left(-y \cdot z\right) - t
\]
| Alternative 12 |
|---|
| Error | 41.3 |
|---|
| Cost | 128 |
|---|
\[-t
\]