?

Average Accuracy: 99.8% → 99.8%
Time: 27.9s
Precision: binary64
Cost: 32832

?

\[ \begin{array}{c}[z, t, a] = \mathsf{sort}([z, t, a])\\ \end{array} \]
\[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
\[\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right)\right) \]
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))
(FPCore (x y z t a b c i)
 :precision binary64
 (fma y i (fma (+ b -0.5) (log c) (+ (fma x (log y) z) (+ t a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return fma(y, i, fma((b + -0.5), log(c), (fma(x, log(y), z) + (t + a))));
}
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i))
end
function code(x, y, z, t, a, b, c, i)
	return fma(y, i, fma(Float64(b + -0.5), log(c), Float64(fma(x, log(y), z) + Float64(t + a))))
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(N[(b + -0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision] + z), $MachinePrecision] + N[(t + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i
\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right)\right)

Error?

Derivation?

  1. Initial program 99.8%

    \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
  2. Simplified99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right)\right)} \]
    Proof

    [Start]99.8

    \[ \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]

    +-commutative [=>]99.8

    \[ \color{blue}{y \cdot i + \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right)} \]

    fma-def [=>]99.8

    \[ \color{blue}{\mathsf{fma}\left(y, i, \left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right)} \]

    +-commutative [=>]99.8

    \[ \mathsf{fma}\left(y, i, \color{blue}{\left(b - 0.5\right) \cdot \log c + \left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right)}\right) \]

    fma-def [=>]99.8

    \[ \mathsf{fma}\left(y, i, \color{blue}{\mathsf{fma}\left(b - 0.5, \log c, \left(\left(x \cdot \log y + z\right) + t\right) + a\right)}\right) \]

    sub-neg [=>]99.8

    \[ \mathsf{fma}\left(y, i, \mathsf{fma}\left(\color{blue}{b + \left(-0.5\right)}, \log c, \left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right) \]

    metadata-eval [=>]99.8

    \[ \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + \color{blue}{-0.5}, \log c, \left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right) \]

    associate-+l+ [=>]99.8

    \[ \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \color{blue}{\left(x \cdot \log y + z\right) + \left(t + a\right)}\right)\right) \]

    fma-def [=>]99.8

    \[ \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \color{blue}{\mathsf{fma}\left(x, \log y, z\right)} + \left(t + a\right)\right)\right) \]
  3. Final simplification99.8%

    \[\leadsto \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right)\right) \]

Alternatives

Alternative 1
Accuracy99.8%
Cost20288
\[\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + \left(y \cdot i + \left(b + -0.5\right) \cdot \log c\right) \]
Alternative 2
Accuracy99.8%
Cost14016
\[y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + \left(b + -0.5\right) \cdot \log c\right) \]
Alternative 3
Accuracy93.3%
Cost13769
\[\begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{+183} \lor \neg \left(x \leq 3.2 \cdot 10^{+91}\right):\\ \;\;\;\;\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(\left(b + -0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\right)\\ \end{array} \]
Alternative 4
Accuracy94.8%
Cost13768
\[\begin{array}{l} t_1 := \left(b + -0.5\right) \cdot \log c\\ \mathbf{if}\;x \leq -9.5 \cdot 10^{+91}:\\ \;\;\;\;t_1 + \left(x \cdot \log y + \left(z + a\right)\right)\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+98}:\\ \;\;\;\;y \cdot i + \left(t_1 + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + y \cdot i\\ \end{array} \]
Alternative 5
Accuracy91.3%
Cost13512
\[\begin{array}{l} \mathbf{if}\;x \leq -4.7 \cdot 10^{+193}:\\ \;\;\;\;y \cdot i + \left(x \cdot \log y + \left(z + t\right)\right)\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+180}:\\ \;\;\;\;y \cdot i + \left(\left(b + -0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a + \mathsf{fma}\left(\log y, x, z + t\right)\\ \end{array} \]
Alternative 6
Accuracy78.2%
Cost7632
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \left(b + -0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\\ \mathbf{if}\;x \leq -4.9 \cdot 10^{+194}:\\ \;\;\;\;y \cdot i + t_1\\ \mathbf{elif}\;x \leq -1.16 \cdot 10^{-205}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-203}:\\ \;\;\;\;y \cdot i + \left(z + \left(t + a\right)\right)\\ \mathbf{elif}\;x \leq 10^{+99}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;a + \left(t_1 + \left(z + t\right)\right)\\ \end{array} \]
Alternative 7
Accuracy79.3%
Cost7632
\[\begin{array}{l} t_1 := x \cdot \log y + \left(z + t\right)\\ t_2 := \left(b + -0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\\ \mathbf{if}\;x \leq -2.7 \cdot 10^{+193}:\\ \;\;\;\;y \cdot i + t_1\\ \mathbf{elif}\;x \leq -7.5 \cdot 10^{-206}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{-203}:\\ \;\;\;\;y \cdot i + \left(z + \left(t + a\right)\right)\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{+99}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;a + t_1\\ \end{array} \]
Alternative 8
Accuracy91.3%
Cost7624
\[\begin{array}{l} t_1 := x \cdot \log y + \left(z + t\right)\\ \mathbf{if}\;x \leq -1.2 \cdot 10^{+197}:\\ \;\;\;\;y \cdot i + t_1\\ \mathbf{elif}\;x \leq 1.7 \cdot 10^{+181}:\\ \;\;\;\;y \cdot i + \left(\left(b + -0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a + t_1\\ \end{array} \]
Alternative 9
Accuracy76.4%
Cost7504
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := a + \left(z + \left(b + -0.5\right) \cdot \log c\right)\\ \mathbf{if}\;x \leq -1.75 \cdot 10^{+193}:\\ \;\;\;\;y \cdot i + t_1\\ \mathbf{elif}\;x \leq -7.8 \cdot 10^{-205}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.45 \cdot 10^{-203}:\\ \;\;\;\;y \cdot i + \left(z + \left(t + a\right)\right)\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+184}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1 + \left(z + t\right)\\ \end{array} \]
Alternative 10
Accuracy77.7%
Cost7504
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := a + \left(z + \left(b + -0.5\right) \cdot \log c\right)\\ \mathbf{if}\;x \leq -4.2 \cdot 10^{+199}:\\ \;\;\;\;y \cdot i + t_1\\ \mathbf{elif}\;x \leq -4.3 \cdot 10^{-204}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.15 \cdot 10^{-201}:\\ \;\;\;\;y \cdot i + \left(z + \left(t + a\right)\right)\\ \mathbf{elif}\;x \leq 1.04 \cdot 10^{+99}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;a + \left(t_1 + \left(z + t\right)\right)\\ \end{array} \]
Alternative 11
Accuracy70.3%
Cost7376
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := y \cdot i + \left(z + \left(t + a\right)\right)\\ \mathbf{if}\;x \leq -6.5 \cdot 10^{+169}:\\ \;\;\;\;y \cdot i + t_1\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-116}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.28 \cdot 10^{-141}:\\ \;\;\;\;b \cdot \log c\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{+180}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1 + \left(z + t\right)\\ \end{array} \]
Alternative 12
Accuracy71.1%
Cost7248
\[\begin{array}{l} t_1 := y \cdot i + \left(z + \left(t + a\right)\right)\\ t_2 := z + x \cdot \log y\\ \mathbf{if}\;x \leq -1.75 \cdot 10^{+170}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-116}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.28 \cdot 10^{-141}:\\ \;\;\;\;b \cdot \log c\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{+182}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 13
Accuracy70.3%
Cost7248
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := y \cdot i + \left(z + \left(t + a\right)\right)\\ \mathbf{if}\;x \leq -5.3 \cdot 10^{+169}:\\ \;\;\;\;y \cdot i + t_1\\ \mathbf{elif}\;x \leq -2.05 \cdot 10^{-116}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.28 \cdot 10^{-141}:\\ \;\;\;\;b \cdot \log c\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{+184}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;z + t_1\\ \end{array} \]
Alternative 14
Accuracy68.7%
Cost7120
\[\begin{array}{l} t_1 := y \cdot i + \left(z + \left(t + a\right)\right)\\ t_2 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.5 \cdot 10^{+170}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2 \cdot 10^{-116}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.28 \cdot 10^{-141}:\\ \;\;\;\;b \cdot \log c\\ \mathbf{elif}\;x \leq 9 \cdot 10^{+182}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 15
Accuracy67.8%
Cost6857
\[\begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{+166} \lor \neg \left(b \leq 2.6 \cdot 10^{+117}\right):\\ \;\;\;\;b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(z + \left(t + a\right)\right)\\ \end{array} \]
Alternative 16
Accuracy51.4%
Cost982
\[\begin{array}{l} \mathbf{if}\;z \leq -2.3 \cdot 10^{+211}:\\ \;\;\;\;z + t\\ \mathbf{elif}\;z \leq -8 \cdot 10^{+198} \lor \neg \left(z \leq -1.9 \cdot 10^{+175} \lor \neg \left(z \leq -7.4 \cdot 10^{+134}\right) \land z \leq -6.5 \cdot 10^{+110}\right):\\ \;\;\;\;a + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;z\\ \end{array} \]
Alternative 17
Accuracy54.2%
Cost717
\[\begin{array}{l} \mathbf{if}\;z \leq -1.4 \cdot 10^{+175} \lor \neg \left(z \leq -7.5 \cdot 10^{+138}\right) \land z \leq -7.2 \cdot 10^{+109}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 18
Accuracy54.3%
Cost717
\[\begin{array}{l} \mathbf{if}\;z \leq -2.9 \cdot 10^{+175}:\\ \;\;\;\;y \cdot i + \left(z + t\right)\\ \mathbf{elif}\;z \leq -5.6 \cdot 10^{+138} \lor \neg \left(z \leq -6.5 \cdot 10^{+110}\right):\\ \;\;\;\;a + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;z + y \cdot i\\ \end{array} \]
Alternative 19
Accuracy62.7%
Cost576
\[y \cdot i + \left(z + \left(t + a\right)\right) \]
Alternative 20
Accuracy44.0%
Cost324
\[\begin{array}{l} \mathbf{if}\;a \leq 9.5 \cdot 10^{+119}:\\ \;\;\;\;z + t\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 21
Accuracy43.7%
Cost196
\[\begin{array}{l} \mathbf{if}\;a \leq 9.5 \cdot 10^{+119}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 22
Accuracy25.8%
Cost64
\[a \]

Error

Reproduce?

herbie shell --seed 2023135 
(FPCore (x y z t a b c i)
  :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, B"
  :precision binary64
  (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))