| Alternative 1 | |
|---|---|
| Error | 15.34% |
| Cost | 6985 |
\[\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+62} \lor \neg \left(z \leq 2.6 \cdot 10^{+128}\right):\\
\;\;\;\;\left(-z\right) - y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log y - y\\
\end{array}
\]
(FPCore (x y z) :precision binary64 (- (- (* x (log y)) z) y))
(FPCore (x y z) :precision binary64 (fma x (log y) (- (- z) y)))
double code(double x, double y, double z) {
return ((x * log(y)) - z) - y;
}
double code(double x, double y, double z) {
return fma(x, log(y), (-z - y));
}
function code(x, y, z) return Float64(Float64(Float64(x * log(y)) - z) - y) end
function code(x, y, z) return fma(x, log(y), Float64(Float64(-z) - y)) end
code[x_, y_, z_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision] - y), $MachinePrecision]
code[x_, y_, z_] := N[(x * N[Log[y], $MachinePrecision] + N[((-z) - y), $MachinePrecision]), $MachinePrecision]
\left(x \cdot \log y - z\right) - y
\mathsf{fma}\left(x, \log y, \left(-z\right) - y\right)
Initial program 0.15
Simplified0.14
[Start]0.15 | \[ \left(x \cdot \log y - z\right) - y
\] |
|---|---|
associate--l- [=>]0.15 | \[ \color{blue}{x \cdot \log y - \left(z + y\right)}
\] |
fma-neg [=>]0.14 | \[ \color{blue}{\mathsf{fma}\left(x, \log y, -\left(z + y\right)\right)}
\] |
distribute-neg-in [=>]0.14 | \[ \mathsf{fma}\left(x, \log y, \color{blue}{\left(-z\right) + \left(-y\right)}\right)
\] |
sub-neg [<=]0.14 | \[ \mathsf{fma}\left(x, \log y, \color{blue}{\left(-z\right) - y}\right)
\] |
Final simplification0.14
| Alternative 1 | |
|---|---|
| Error | 15.34% |
| Cost | 6985 |
| Alternative 2 | |
|---|---|
| Error | 21.22% |
| Cost | 6857 |
| Alternative 3 | |
|---|---|
| Error | 14.53% |
| Cost | 6852 |
| Alternative 4 | |
|---|---|
| Error | 0.15% |
| Cost | 6848 |
| Alternative 5 | |
|---|---|
| Error | 48.34% |
| Cost | 260 |
| Alternative 6 | |
|---|---|
| Error | 33.93% |
| Cost | 256 |
| Alternative 7 | |
|---|---|
| Error | 66.95% |
| Cost | 128 |
herbie shell --seed 2023088
(FPCore (x y z)
:name "Statistics.Distribution.Poisson:$clogProbability from math-functions-0.1.5.2"
:precision binary64
(- (- (* x (log y)) z) y))