| Alternative 1 | |
|---|---|
| Error | 8.9 |
| Cost | 6985 |
\[\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{+20} \lor \neg \left(x \leq 1.55 \cdot 10^{+28}\right):\\
\;\;\;\;x \cdot \log y - y\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) - 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.1
Simplified0.1
[Start]0.1 | \[ \left(x \cdot \log y - z\right) - y
\] |
|---|---|
associate--l- [=>]0.1 | \[ \color{blue}{x \cdot \log y - \left(z + y\right)}
\] |
fma-neg [=>]0.1 | \[ \color{blue}{\mathsf{fma}\left(x, \log y, -\left(z + y\right)\right)}
\] |
distribute-neg-in [=>]0.1 | \[ \mathsf{fma}\left(x, \log y, \color{blue}{\left(-z\right) + \left(-y\right)}\right)
\] |
sub-neg [<=]0.1 | \[ \mathsf{fma}\left(x, \log y, \color{blue}{\left(-z\right) - y}\right)
\] |
Final simplification0.1
| Alternative 1 | |
|---|---|
| Error | 8.9 |
| Cost | 6985 |
| Alternative 2 | |
|---|---|
| Error | 9.4 |
| Cost | 6984 |
| Alternative 3 | |
|---|---|
| Error | 12.9 |
| Cost | 6857 |
| Alternative 4 | |
|---|---|
| Error | 0.1 |
| Cost | 6848 |
| Alternative 5 | |
|---|---|
| Error | 30.3 |
| Cost | 260 |
| Alternative 6 | |
|---|---|
| Error | 21.4 |
| Cost | 256 |
| Alternative 7 | |
|---|---|
| Error | 41.9 |
| Cost | 128 |
herbie shell --seed 2023039
(FPCore (x y z)
:name "Statistics.Distribution.Poisson:$clogProbability from math-functions-0.1.5.2"
:precision binary64
(- (- (* x (log y)) z) y))