?

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

    associate-+l+ [=>]99.8

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

    +-commutative [=>]99.8

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

    +-commutative [=>]99.8

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

    associate-+l+ [=>]99.8

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

    associate-+r+ [=>]99.8

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

    associate-+r+ [=>]99.8

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

    +-commutative [=>]99.8

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

    associate-+l+ [=>]99.8

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

    associate-+r+ [=>]99.8

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

    +-commutative [<=]99.8

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

    +-commutative [<=]99.8

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

    fma-def [=>]99.8

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

    associate-+r+ [=>]99.8

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

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

Alternatives

Alternative 1
Accuracy69.5%
Cost47834
\[\begin{array}{l} t_1 := \left(b + -0.5\right) \cdot \log c\\ t_2 := t_1 + \left(t + \left(z + a\right)\right)\\ t_3 := x \cdot \log y\\ \mathbf{if}\;t_1 \leq -2 \cdot 10^{+114}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq -330:\\ \;\;\;\;y \cdot i + \left(z + t_3\right)\\ \mathbf{elif}\;t_1 \leq -300 \lor \neg \left(t_1 \leq -80\right) \land \left(t_1 \leq 254 \lor \neg \left(t_1 \leq 5 \cdot 10^{+91}\right)\right):\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + \left(y \cdot i + t_3\right)\right)\\ \end{array} \]
Alternative 2
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 3
Accuracy96.0%
Cost14025
\[\begin{array}{l} t_1 := \left(b + -0.5\right) \cdot \log c\\ \mathbf{if}\;x \leq -1.45 \cdot 10^{+113} \lor \neg \left(x \leq 6.5 \cdot 10^{+67}\right):\\ \;\;\;\;t_1 + \left(x \cdot \log y + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(t_1 + \left(z + \left(t + a\right)\right)\right)\\ \end{array} \]
Alternative 4
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 5
Accuracy94.6%
Cost13769
\[\begin{array}{l} \mathbf{if}\;x \leq -1.3 \cdot 10^{+114} \lor \neg \left(x \leq 2.1 \cdot 10^{+110}\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(z + \left(t + a\right)\right)\right)\\ \end{array} \]
Alternative 6
Accuracy91.6%
Cost13512
\[\begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{+220}:\\ \;\;\;\;y \cdot i + \left(z + x \cdot \log y\right)\\ \mathbf{elif}\;x \leq 3 \cdot 10^{+146}:\\ \;\;\;\;y \cdot i + \left(\left(b + -0.5\right) \cdot \log c + \left(z + \left(t + a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + \mathsf{fma}\left(x, \log y, a\right)\right)\\ \end{array} \]
Alternative 7
Accuracy91.6%
Cost13512
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+222}:\\ \;\;\;\;z + \left(t + \mathsf{fma}\left(x, \log y, y \cdot i\right)\right)\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+145}:\\ \;\;\;\;y \cdot i + \left(\left(b + -0.5\right) \cdot \log c + \left(z + \left(t + a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + \mathsf{fma}\left(x, \log y, a\right)\right)\\ \end{array} \]
Alternative 8
Accuracy41.6%
Cost8176
\[\begin{array}{l} t_1 := y \cdot i + \left(z + t\right)\\ t_2 := x \cdot \log y\\ t_3 := b \cdot \log c\\ \mathbf{if}\;x \leq -1.6 \cdot 10^{+185}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-261}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-307}:\\ \;\;\;\;a\\ \mathbf{elif}\;x \leq 5.9 \cdot 10^{-257}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{-223}:\\ \;\;\;\;a\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-119}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.2 \cdot 10^{-86}:\\ \;\;\;\;a\\ \mathbf{elif}\;x \leq 16000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{+109}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{+166}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4 \cdot 10^{+189}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{+233}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Accuracy55.8%
Cost8037
\[\begin{array}{l} t_1 := \left(b + -0.5\right) \cdot \log c\\ t_2 := z + t_1\\ t_3 := x \cdot \log y\\ t_4 := z + \left(t + t_3\right)\\ \mathbf{if}\;a \leq -2.4 \cdot 10^{-280}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 1.05 \cdot 10^{-206}:\\ \;\;\;\;y \cdot i + t_3\\ \mathbf{elif}\;a \leq 7.5 \cdot 10^{-65}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 1.85 \cdot 10^{-28}:\\ \;\;\;\;z + t_3\\ \mathbf{elif}\;a \leq 0.0072:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 5.5 \cdot 10^{+80}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;a \leq 6.8 \cdot 10^{+115}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 2.6 \cdot 10^{+181} \lor \neg \left(a \leq 1.1 \cdot 10^{+224}\right):\\ \;\;\;\;a + t_1\\ \mathbf{else}:\\ \;\;\;\;t_4\\ \end{array} \]
Alternative 10
Accuracy47.8%
Cost8036
\[\begin{array}{l} t_1 := z + \left(t + x \cdot \log y\right)\\ t_2 := z + y \cdot i\\ t_3 := y \cdot i + \left(z + t\right)\\ \mathbf{if}\;x \leq -2.3 \cdot 10^{+103}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{-262}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.32 \cdot 10^{-307}:\\ \;\;\;\;a\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-253}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{-223}:\\ \;\;\;\;a\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-119}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-84}:\\ \;\;\;\;a\\ \mathbf{elif}\;x \leq 7200000:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+109}:\\ \;\;\;\;b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Accuracy45.9%
Cost8036
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := y \cdot i + \left(z + t\right)\\ t_3 := z + y \cdot i\\ \mathbf{if}\;x \leq -1.25 \cdot 10^{+102}:\\ \;\;\;\;y \cdot i + t_1\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{-255}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-307}:\\ \;\;\;\;a\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-253}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 1.02 \cdot 10^{-221}:\\ \;\;\;\;a\\ \mathbf{elif}\;x \leq 4.1 \cdot 10^{-119}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{-83}:\\ \;\;\;\;a\\ \mathbf{elif}\;x \leq 7200000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+109}:\\ \;\;\;\;b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + t_1\right)\\ \end{array} \]
Alternative 12
Accuracy65.3%
Cost8029
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \left(b + -0.5\right) \cdot \log c\\ t_3 := z + t_2\\ t_4 := z + \left(t + \left(y \cdot i + t_1\right)\right)\\ \mathbf{if}\;a \leq 4.2 \cdot 10^{-112}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;a \leq 4.4 \cdot 10^{-66}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 2.95 \cdot 10^{-28}:\\ \;\;\;\;y \cdot i + \left(z + t_1\right)\\ \mathbf{elif}\;a \leq 0.0071:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 7 \cdot 10^{+126} \lor \neg \left(a \leq 2.25 \cdot 10^{+180}\right) \land a \leq 1.1 \cdot 10^{+224}:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;a + t_2\\ \end{array} \]
Alternative 13
Accuracy47.5%
Cost7908
\[\begin{array}{l} t_1 := z + x \cdot \log y\\ t_2 := z + y \cdot i\\ t_3 := y \cdot i + \left(z + t\right)\\ \mathbf{if}\;x \leq -2 \cdot 10^{+113}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{-262}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{-307}:\\ \;\;\;\;a\\ \mathbf{elif}\;x \leq 6.8 \cdot 10^{-257}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{-223}:\\ \;\;\;\;a\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-119}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 2 \cdot 10^{-81}:\\ \;\;\;\;a\\ \mathbf{elif}\;x \leq 7200000:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+109}:\\ \;\;\;\;b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Accuracy64.9%
Cost7901
\[\begin{array}{l} t_1 := \left(b + -0.5\right) \cdot \log c\\ t_2 := z + t_1\\ t_3 := y \cdot i + \left(z + x \cdot \log y\right)\\ \mathbf{if}\;a \leq 4.2 \cdot 10^{-112}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 2.75 \cdot 10^{-66}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 3.1 \cdot 10^{-28}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 0.0135:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 1.22 \cdot 10^{+126} \lor \neg \left(a \leq 2 \cdot 10^{+181}\right) \land a \leq 1.1 \cdot 10^{+224}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;a + t_1\\ \end{array} \]
Alternative 15
Accuracy90.2%
Cost7888
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := y \cdot i + \left(\left(b + -0.5\right) \cdot \log c + \left(z + \left(t + a\right)\right)\right)\\ t_3 := y \cdot i + \left(z + t_1\right)\\ \mathbf{if}\;x \leq -5.2 \cdot 10^{+220}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+139}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.95 \cdot 10^{+169}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 4.6 \cdot 10^{+218}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + \left(y \cdot i + t_1\right)\right)\\ \end{array} \]
Alternative 16
Accuracy53.0%
Cost7773
\[\begin{array}{l} t_1 := a + \left(b + -0.5\right) \cdot \log c\\ t_2 := z + \left(t + x \cdot \log y\right)\\ \mathbf{if}\;a \leq 4.2 \cdot 10^{-112}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + t\right)\\ \mathbf{elif}\;a \leq 2.75 \cdot 10^{-66}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 3 \cdot 10^{+62}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 1.65 \cdot 10^{+90}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 7.2 \cdot 10^{+115}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;a \leq 2.5 \cdot 10^{+182} \lor \neg \left(a \leq 1.1 \cdot 10^{+224}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 17
Accuracy51.5%
Cost580
\[\begin{array}{l} \mathbf{if}\;a \leq 7.2 \cdot 10^{+115}:\\ \;\;\;\;y \cdot i + \left(z + t\right)\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 18
Accuracy51.2%
Cost452
\[\begin{array}{l} \mathbf{if}\;a \leq 6.5 \cdot 10^{+115}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 19
Accuracy43.8%
Cost324
\[\begin{array}{l} \mathbf{if}\;z \leq -4 \cdot 10^{+99}:\\ \;\;\;\;z + t\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 20
Accuracy43.5%
Cost196
\[\begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{+99}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 21
Accuracy25.6%
Cost64
\[a \]

Error

Reproduce?

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