| Alternative 1 | |
|---|---|
| Error | 1.25% |
| Cost | 13513 |
\[\begin{array}{l}
t_1 := x \cdot \log y - y\\
\mathbf{if}\;z \leq -4 \cdot 10^{+16} \lor \neg \left(z \leq 3.6 \cdot 10^{-26}\right):\\
\;\;\;\;t_1 - z\\
\mathbf{else}:\\
\;\;\;\;\log t + t_1\\
\end{array}
\]
(FPCore (x y z t) :precision binary64 (+ (- (- (* x (log y)) y) z) (log t)))
(FPCore (x y z t) :precision binary64 (- (- (fma x (log y) (log t)) y) z))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - y) - z) + log(t);
}
double code(double x, double y, double z, double t) {
return (fma(x, log(y), log(t)) - y) - z;
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - y) - z) + log(t)) end
function code(x, y, z, t) return Float64(Float64(fma(x, log(y), log(t)) - y) - z) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision] + N[Log[t], $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] - z), $MachinePrecision]
\left(\left(x \cdot \log y - y\right) - z\right) + \log t
\left(\mathsf{fma}\left(x, \log y, \log t\right) - y\right) - z
Initial program 0.15
Simplified0.15
[Start]0.15 | \[ \left(\left(x \cdot \log y - y\right) - z\right) + \log t
\] |
|---|---|
+-lft-identity [<=]0.15 | \[ \color{blue}{0 + \left(\left(\left(x \cdot \log y - y\right) - z\right) + \log t\right)}
\] |
+-commutative [=>]0.15 | \[ 0 + \color{blue}{\left(\log t + \left(\left(x \cdot \log y - y\right) - z\right)\right)}
\] |
associate-+r- [=>]0.15 | \[ 0 + \color{blue}{\left(\left(\log t + \left(x \cdot \log y - y\right)\right) - z\right)}
\] |
associate-+r- [=>]0.15 | \[ \color{blue}{\left(0 + \left(\log t + \left(x \cdot \log y - y\right)\right)\right) - z}
\] |
+-lft-identity [=>]0.15 | \[ \color{blue}{\left(\log t + \left(x \cdot \log y - y\right)\right)} - z
\] |
associate-+r- [=>]0.15 | \[ \color{blue}{\left(\left(\log t + x \cdot \log y\right) - y\right)} - z
\] |
+-commutative [=>]0.15 | \[ \left(\color{blue}{\left(x \cdot \log y + \log t\right)} - y\right) - z
\] |
fma-def [=>]0.15 | \[ \left(\color{blue}{\mathsf{fma}\left(x, \log y, \log t\right)} - y\right) - z
\] |
Final simplification0.15
| Alternative 1 | |
|---|---|
| Error | 1.25% |
| Cost | 13513 |
| Alternative 2 | |
|---|---|
| Error | 0.15% |
| Cost | 13376 |
| Alternative 3 | |
|---|---|
| Error | 23.08% |
| Cost | 7248 |
| Alternative 4 | |
|---|---|
| Error | 28.85% |
| Cost | 7120 |
| Alternative 5 | |
|---|---|
| Error | 0.82% |
| Cost | 7113 |
| Alternative 6 | |
|---|---|
| Error | 0.83% |
| Cost | 7112 |
| Alternative 7 | |
|---|---|
| Error | 44.56% |
| Cost | 6992 |
| Alternative 8 | |
|---|---|
| Error | 10.2% |
| Cost | 6985 |
| Alternative 9 | |
|---|---|
| Error | 27.85% |
| Cost | 6857 |
| Alternative 10 | |
|---|---|
| Error | 41.71% |
| Cost | 256 |
| Alternative 11 | |
|---|---|
| Error | 69.39% |
| Cost | 128 |
herbie shell --seed 2023121
(FPCore (x y z t)
:name "Numeric.SpecFunctions:incompleteGamma from math-functions-0.1.5.2, A"
:precision binary64
(+ (- (- (* x (log y)) y) z) (log t)))