| Alternative 1 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 13184 |
\[\mathsf{fma}\left(x, \log y, \left(-z\right) - y\right)
\]

(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)
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
Initial program 99.9%
Simplified99.9%
[Start]99.9% | \[ \left(x \cdot \log y - z\right) - y
\] |
|---|---|
sub-neg [=>]99.9% | \[ \color{blue}{\left(x \cdot \log y + \left(-z\right)\right)} - y
\] |
associate--l+ [=>]99.9% | \[ \color{blue}{x \cdot \log y + \left(\left(-z\right) - y\right)}
\] |
fma-def [=>]99.9% | \[ \color{blue}{\mathsf{fma}\left(x, \log y, \left(-z\right) - y\right)}
\] |
Final simplification99.9%
| Alternative 1 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 13184 |
| Alternative 2 | |
|---|---|
| Accuracy | 85.2% |
| Cost | 6985 |
| Alternative 3 | |
|---|---|
| Accuracy | 79.0% |
| Cost | 6857 |
| Alternative 4 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 6848 |
| Alternative 5 | |
|---|---|
| Accuracy | 51.9% |
| Cost | 260 |
| Alternative 6 | |
|---|---|
| Accuracy | 66.5% |
| Cost | 256 |
| Alternative 7 | |
|---|---|
| Accuracy | 34.9% |
| Cost | 128 |
herbie shell --seed 2023272
(FPCore (x y z)
:name "Statistics.Distribution.Poisson:$clogProbability from math-functions-0.1.5.2"
:precision binary64
(- (- (* x (log y)) z) y))