?

Average Accuracy: 99.8% → 99.8%
Time: 29.4s
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(x, \log y, \mathsf{fma}\left(b + -0.5, \log c, t\right)\right) + \mathsf{fma}\left(y, i, z + a\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 x (log y) (fma (+ b -0.5) (log c) t)) (fma y i (+ z 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(x, log(y), fma((b + -0.5), log(c), t)) + fma(y, i, (z + 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 Float64(fma(x, log(y), fma(Float64(b + -0.5), log(c), t)) + fma(y, i, Float64(z + 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[(N[(x * N[Log[y], $MachinePrecision] + N[(N[(b + -0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * i + N[(z + a), $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(x, \log y, \mathsf{fma}\left(b + -0.5, \log c, t\right)\right) + \mathsf{fma}\left(y, i, z + a\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(x, \log y, \mathsf{fma}\left(b + -0.5, \log c, t\right)\right) + \mathsf{fma}\left(y, i, z + a\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}{\left(\left(b - 0.5\right) \cdot \log c + \left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right)} + y \cdot i \]

    associate-+l+ [=>]99.8

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

    +-commutative [=>]99.8

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

    associate-+l+ [=>]99.8

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

    +-commutative [=>]99.8

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

    associate-+l+ [=>]99.8

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

    associate-+l+ [=>]99.8

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

    associate-+r+ [=>]99.8

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

    +-commutative [<=]99.8

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

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

Alternatives

Alternative 1
Accuracy99.8%
Cost14016
\[\left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + \log c \cdot \left(b + -0.5\right)\right) + y \cdot i \]
Alternative 2
Accuracy95.0%
Cost13896
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.65 \cdot 10^{+103}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right) + t_1\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{+47}:\\ \;\;\;\;y \cdot i + \left(a + \left(\log c \cdot \left(b + -0.5\right) + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z + \left(a + \left(t_1 + \left(t + b \cdot \log c\right)\right)\right)\\ \end{array} \]
Alternative 3
Accuracy94.5%
Cost13641
\[\begin{array}{l} \mathbf{if}\;x \leq -1.05 \cdot 10^{+98} \lor \neg \left(x \leq 3.15 \cdot 10^{+84}\right):\\ \;\;\;\;\mathsf{fma}\left(y, i, z + a\right) + x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(a + \left(\log c \cdot \left(b + -0.5\right) + \left(t + z\right)\right)\right)\\ \end{array} \]
Alternative 4
Accuracy92.5%
Cost13513
\[\begin{array}{l} \mathbf{if}\;x \leq -3 \cdot 10^{+203} \lor \neg \left(x \leq 5.3 \cdot 10^{+166}\right):\\ \;\;\;\;z + \left(t + \mathsf{fma}\left(x, \log y, a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(a + \left(\log c \cdot \left(b + -0.5\right) + \left(t + z\right)\right)\right)\\ \end{array} \]
Alternative 5
Accuracy66.5%
Cost8297
\[\begin{array}{l} t_1 := z + \left(a + x \cdot \log y\right)\\ t_2 := b \cdot \log c\\ t_3 := y \cdot i + \left(a + t_2\right)\\ t_4 := a + \left(z + \log c \cdot \left(b + -0.5\right)\right)\\ \mathbf{if}\;i \leq -8.8 \cdot 10^{+161}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;i \leq -0.0065:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq -3.9 \cdot 10^{-188}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;i \leq 2.9 \cdot 10^{-278}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 4.6 \cdot 10^{-219}:\\ \;\;\;\;z + \left(a + \left(t + t_2\right)\right)\\ \mathbf{elif}\;i \leq 4.1 \cdot 10^{-87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;i \leq 4.8 \cdot 10^{-17}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;i \leq 5.8 \cdot 10^{+49} \lor \neg \left(i \leq 8 \cdot 10^{+80}\right) \land i \leq 4.5 \cdot 10^{+259}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 6
Accuracy67.8%
Cost8297
\[\begin{array}{l} t_1 := b \cdot \log c\\ t_2 := z + \left(a + x \cdot \log y\right)\\ t_3 := y \cdot i + \left(a + t_1\right)\\ t_4 := a + \left(z + \log c \cdot \left(b + -0.5\right)\right)\\ \mathbf{if}\;i \leq -1.6 \cdot 10^{+157}:\\ \;\;\;\;y \cdot i + \left(z + t_1\right)\\ \mathbf{elif}\;i \leq -4000:\\ \;\;\;\;t_3\\ \mathbf{elif}\;i \leq -4.1 \cdot 10^{-189}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;i \leq 2.2 \cdot 10^{-277}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 5 \cdot 10^{-219}:\\ \;\;\;\;z + \left(a + \left(t + t_1\right)\right)\\ \mathbf{elif}\;i \leq 10^{-86}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;i \leq 1.2 \cdot 10^{-17}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;i \leq 8.4 \cdot 10^{+49} \lor \neg \left(i \leq 2.1 \cdot 10^{+79}\right) \land i \leq 1.8 \cdot 10^{+259}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 7
Accuracy81.7%
Cost7632
\[\begin{array}{l} t_1 := z + \left(a + \left(t + \log c \cdot \left(b + -0.5\right)\right)\right)\\ t_2 := z + \left(a + x \cdot \log y\right)\\ \mathbf{if}\;x \leq -3 \cdot 10^{+88}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.1 \cdot 10^{-262}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-294}:\\ \;\;\;\;y \cdot i + \left(z + b \cdot \log c\right)\\ \mathbf{elif}\;x \leq 3.9 \cdot 10^{+84}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 8
Accuracy92.4%
Cost7625
\[\begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{+203} \lor \neg \left(x \leq 2.6 \cdot 10^{+166}\right):\\ \;\;\;\;z + \left(a + x \cdot \log y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(a + \left(\log c \cdot \left(b + -0.5\right) + \left(t + z\right)\right)\right)\\ \end{array} \]
Alternative 9
Accuracy76.1%
Cost7369
\[\begin{array}{l} \mathbf{if}\;b + -0.5 \leq -2 \cdot 10^{+168} \lor \neg \left(b + -0.5 \leq 5 \cdot 10^{+207}\right):\\ \;\;\;\;z + b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;z + \left(a + x \cdot \log y\right)\\ \end{array} \]
Alternative 10
Accuracy60.7%
Cost7248
\[\begin{array}{l} t_1 := z + \left(t + a\right)\\ t_2 := z + b \cdot \log c\\ \mathbf{if}\;b \leq -5.2 \cdot 10^{+160}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq 2.25 \cdot 10^{-199}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 5 \cdot 10^{-78}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;b \leq 1.52 \cdot 10^{+174}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 11
Accuracy81.7%
Cost7241
\[\begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{+95} \lor \neg \left(x \leq 4.9 \cdot 10^{+84}\right):\\ \;\;\;\;z + \left(a + x \cdot \log y\right)\\ \mathbf{else}:\\ \;\;\;\;a + \left(z + \log c \cdot \left(b + -0.5\right)\right)\\ \end{array} \]
Alternative 12
Accuracy57.1%
Cost7120
\[\begin{array}{l} t_1 := z + \left(t + a\right)\\ t_2 := b \cdot \log c\\ \mathbf{if}\;b \leq -2.5 \cdot 10^{+166}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq 2.25 \cdot 10^{-199}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-77}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;b \leq 5.5 \cdot 10^{+237}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 13
Accuracy42.9%
Cost588
\[\begin{array}{l} \mathbf{if}\;a \leq 10^{-121}:\\ \;\;\;\;t + z\\ \mathbf{elif}\;a \leq 1.26 \cdot 10^{-68}:\\ \;\;\;\;y \cdot i\\ \mathbf{elif}\;a \leq 4.1 \cdot 10^{+131}:\\ \;\;\;\;t + z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 14
Accuracy42.6%
Cost460
\[\begin{array}{l} \mathbf{if}\;a \leq 9.6 \cdot 10^{-122}:\\ \;\;\;\;z\\ \mathbf{elif}\;a \leq 1.26 \cdot 10^{-68}:\\ \;\;\;\;y \cdot i\\ \mathbf{elif}\;a \leq 6.9 \cdot 10^{+130}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 15
Accuracy52.5%
Cost452
\[\begin{array}{l} \mathbf{if}\;a \leq 2.05 \cdot 10^{+139}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 16
Accuracy57.2%
Cost452
\[\begin{array}{l} \mathbf{if}\;a \leq 2.35 \cdot 10^{+22}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + a\right)\\ \end{array} \]
Alternative 17
Accuracy43.1%
Cost196
\[\begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{+98}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 18
Accuracy25.7%
Cost64
\[a \]

Error

Reproduce?

herbie shell --seed 2023133 
(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)))