| Alternative 1 | |
|---|---|
| Error | 1.77% |
| Cost | 13380 |
\[\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;y \leq 1.15 \cdot 10^{-35}:\\
\;\;\;\;\left(\log t + t_1\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 - y\right) - z\\
\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.12
Simplified0.12
[Start]0.12 | \[ \left(\left(x \cdot \log y - y\right) - z\right) + \log t
\] |
|---|---|
+-lft-identity [<=]0.12 | \[ \color{blue}{0 + \left(\left(\left(x \cdot \log y - y\right) - z\right) + \log t\right)}
\] |
+-commutative [=>]0.12 | \[ 0 + \color{blue}{\left(\log t + \left(\left(x \cdot \log y - y\right) - z\right)\right)}
\] |
associate-+r- [=>]0.12 | \[ 0 + \color{blue}{\left(\left(\log t + \left(x \cdot \log y - y\right)\right) - z\right)}
\] |
associate-+r- [=>]0.12 | \[ \color{blue}{\left(0 + \left(\log t + \left(x \cdot \log y - y\right)\right)\right) - z}
\] |
+-lft-identity [=>]0.12 | \[ \color{blue}{\left(\log t + \left(x \cdot \log y - y\right)\right)} - z
\] |
associate-+r- [=>]0.12 | \[ \color{blue}{\left(\left(\log t + x \cdot \log y\right) - y\right)} - z
\] |
+-commutative [=>]0.12 | \[ \left(\color{blue}{\left(x \cdot \log y + \log t\right)} - y\right) - z
\] |
fma-def [=>]0.12 | \[ \left(\color{blue}{\mathsf{fma}\left(x, \log y, \log t\right)} - y\right) - z
\] |
Final simplification0.12
| Alternative 1 | |
|---|---|
| Error | 1.77% |
| Cost | 13380 |
| Alternative 2 | |
|---|---|
| Error | 0.12% |
| Cost | 13376 |
| Alternative 3 | |
|---|---|
| Error | 25.67% |
| Cost | 7512 |
| Alternative 4 | |
|---|---|
| Error | 11.85% |
| Cost | 7249 |
| Alternative 5 | |
|---|---|
| Error | 29.91% |
| Cost | 7120 |
| Alternative 6 | |
|---|---|
| Error | 1.17% |
| Cost | 7113 |
| Alternative 7 | |
|---|---|
| Error | 28.5% |
| Cost | 6857 |
| Alternative 8 | |
|---|---|
| Error | 42.94% |
| Cost | 6729 |
| Alternative 9 | |
|---|---|
| Error | 51.12% |
| Cost | 392 |
| Alternative 10 | |
|---|---|
| Error | 41.15% |
| Cost | 256 |
| Alternative 11 | |
|---|---|
| Error | 68.84% |
| Cost | 128 |
herbie shell --seed 2023090
(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)))