?

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

?

\[\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
Accuracy95.1%
Cost14025
\[\begin{array}{l} t_1 := \log c \cdot \left(b + -0.5\right)\\ \mathbf{if}\;x \leq -2.45 \cdot 10^{+112} \lor \neg \left(x \leq 0.0102\right):\\ \;\;\;\;z + \left(t + \left(t_1 + \left(a + x \cdot \log y\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(t_1 + \left(z + \left(t + a\right)\right)\right)\\ \end{array} \]
Alternative 2
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 3
Accuracy91.9%
Cost13896
\[\begin{array}{l} t_1 := \log c \cdot \left(b + -0.5\right)\\ t_2 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.25 \cdot 10^{+171}:\\ \;\;\;\;z + \left(t_2 + \left(t + a\right)\right)\\ \mathbf{elif}\;x \leq 2.45 \cdot 10^{+78}:\\ \;\;\;\;y \cdot i + \left(t_1 + \left(z + \left(t + a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + \left(t_1 + t_2\right)\right)\\ \end{array} \]
Alternative 4
Accuracy55.6%
Cost8164
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := z + t_1\\ t_3 := a + \left(y \cdot i + b \cdot \log c\right)\\ t_4 := z + \left(t + a\right)\\ \mathbf{if}\;x \leq -1.4 \cdot 10^{+213}:\\ \;\;\;\;z + \left(t + t_1\right)\\ \mathbf{elif}\;x \leq -2.75 \cdot 10^{+181}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -8.5 \cdot 10^{+159}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -3.2 \cdot 10^{+33}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;x \leq -1.14 \cdot 10^{-138}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-297}:\\ \;\;\;\;z + \log c \cdot \left(b + -0.5\right)\\ \mathbf{elif}\;x \leq 8.6 \cdot 10^{-147}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-49}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;x \leq 0.038:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 2.45 \cdot 10^{+78}:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Accuracy76.2%
Cost8017
\[\begin{array}{l} t_1 := b \cdot \log c\\ \mathbf{if}\;b + -0.5 \leq -1 \cdot 10^{+176}:\\ \;\;\;\;z + \left(t + t_1\right)\\ \mathbf{elif}\;b + -0.5 \leq -5 \cdot 10^{+77} \lor \neg \left(b + -0.5 \leq -1 \cdot 10^{+45}\right) \land b + -0.5 \leq 5 \cdot 10^{+208}:\\ \;\;\;\;z + \left(x \cdot \log y + \left(t + a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a + \left(y \cdot i + t_1\right)\\ \end{array} \]
Alternative 6
Accuracy75.7%
Cost8017
\[\begin{array}{l} \mathbf{if}\;b + -0.5 \leq -1 \cdot 10^{+176}:\\ \;\;\;\;y \cdot i + \left(z + \log c \cdot \left(b + -0.5\right)\right)\\ \mathbf{elif}\;b + -0.5 \leq -5 \cdot 10^{+77} \lor \neg \left(b + -0.5 \leq -1 \cdot 10^{+45}\right) \land b + -0.5 \leq 5 \cdot 10^{+208}:\\ \;\;\;\;z + \left(x \cdot \log y + \left(t + a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a + \left(y \cdot i + b \cdot \log c\right)\\ \end{array} \]
Alternative 7
Accuracy50.6%
Cost7772
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \log c \cdot \left(b + -0.5\right)\\ t_3 := z + t_2\\ \mathbf{if}\;a \leq -8.5 \cdot 10^{-245}:\\ \;\;\;\;z + \left(t + t_1\right)\\ \mathbf{elif}\;a \leq 2.1 \cdot 10^{-67}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 2.1 \cdot 10^{-39}:\\ \;\;\;\;y \cdot i\\ \mathbf{elif}\;a \leq 1.6 \cdot 10^{-18}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 33:\\ \;\;\;\;z + t_1\\ \mathbf{elif}\;a \leq 1400000000:\\ \;\;\;\;a + t_2\\ \mathbf{elif}\;a \leq 1.4 \cdot 10^{+84}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + a\right)\\ \end{array} \]
Alternative 8
Accuracy65.8%
Cost7769
\[\begin{array}{l} t_1 := \log c \cdot \left(b + -0.5\right)\\ t_2 := a + \left(t_1 + y \cdot i\right)\\ t_3 := z + \left(x \cdot \log y + \left(t + a\right)\right)\\ \mathbf{if}\;x \leq -2.3 \cdot 10^{+33}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -2.05 \cdot 10^{-141}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-244}:\\ \;\;\;\;z + t_1\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-144}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.5 \cdot 10^{-48} \lor \neg \left(x \leq 0.42\right):\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;a + \left(y \cdot i + b \cdot \log c\right)\\ \end{array} \]
Alternative 9
Accuracy92.3%
Cost7625
\[\begin{array}{l} \mathbf{if}\;x \leq -3.9 \cdot 10^{+171} \lor \neg \left(x \leq 3 \cdot 10^{+115}\right):\\ \;\;\;\;z + \left(x \cdot \log y + \left(t + a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b + -0.5\right) + \left(z + \left(t + a\right)\right)\right)\\ \end{array} \]
Alternative 10
Accuracy59.1%
Cost7512
\[\begin{array}{l} t_1 := z + \left(t + a\right)\\ t_2 := a + b \cdot \log c\\ t_3 := z + x \cdot \log y\\ \mathbf{if}\;x \leq -1.9 \cdot 10^{+161}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -200:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-34}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{-48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-13}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.45 \cdot 10^{+78}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 11
Accuracy59.9%
Cost7512
\[\begin{array}{l} t_1 := z + \left(t + a\right)\\ t_2 := z + x \cdot \log y\\ t_3 := b \cdot \log c\\ \mathbf{if}\;x \leq -3.8 \cdot 10^{+160}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -3800:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-283}:\\ \;\;\;\;z + \left(t + t_3\right)\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.1 \cdot 10^{-13}:\\ \;\;\;\;a + t_3\\ \mathbf{elif}\;x \leq 1.52 \cdot 10^{+78}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 12
Accuracy60.8%
Cost7512
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := z + \left(t + a\right)\\ t_3 := b \cdot \log c\\ \mathbf{if}\;x \leq -9 \cdot 10^{+159}:\\ \;\;\;\;z + \left(t + t_1\right)\\ \mathbf{elif}\;x \leq -245:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-286}:\\ \;\;\;\;z + \left(t + t_3\right)\\ \mathbf{elif}\;x \leq 1.35 \cdot 10^{-48}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.28 \cdot 10^{-8}:\\ \;\;\;\;a + t_3\\ \mathbf{elif}\;x \leq 2.45 \cdot 10^{+78}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;z + t_1\\ \end{array} \]
Alternative 13
Accuracy50.8%
Cost7376
\[\begin{array}{l} t_1 := z + \log c \cdot \left(b + -0.5\right)\\ \mathbf{if}\;a \leq -6.8 \cdot 10^{-243}:\\ \;\;\;\;z + \left(t + x \cdot \log y\right)\\ \mathbf{elif}\;a \leq 2.1 \cdot 10^{-67}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 2.1 \cdot 10^{-39}:\\ \;\;\;\;y \cdot i\\ \mathbf{elif}\;a \leq 1.8 \cdot 10^{+84}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + a\right)\\ \end{array} \]
Alternative 14
Accuracy41.7%
Cost7117
\[\begin{array}{l} \mathbf{if}\;z \leq -2.65 \cdot 10^{+85}:\\ \;\;\;\;z + \left(t + a\right)\\ \mathbf{elif}\;z \leq -3.7 \cdot 10^{-100} \lor \neg \left(z \leq 5.5 \cdot 10^{-287}\right):\\ \;\;\;\;a + b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 15
Accuracy59.2%
Cost6857
\[\begin{array}{l} \mathbf{if}\;b \leq -7.4 \cdot 10^{+172} \lor \neg \left(b \leq 6 \cdot 10^{+211}\right):\\ \;\;\;\;b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + a\right)\\ \end{array} \]
Alternative 16
Accuracy23.7%
Cost460
\[\begin{array}{l} \mathbf{if}\;a \leq 1.4 \cdot 10^{-77}:\\ \;\;\;\;z\\ \mathbf{elif}\;a \leq 4.4 \cdot 10^{-39}:\\ \;\;\;\;y \cdot i\\ \mathbf{elif}\;a \leq 4.9 \cdot 10^{+82}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 17
Accuracy36.1%
Cost460
\[\begin{array}{l} \mathbf{if}\;a \leq 2.35 \cdot 10^{-73}:\\ \;\;\;\;z + t\\ \mathbf{elif}\;a \leq 3.8 \cdot 10^{-39}:\\ \;\;\;\;y \cdot i\\ \mathbf{elif}\;a \leq 4.2 \cdot 10^{+82}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 18
Accuracy36.1%
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{+83}:\\ \;\;\;\;z + t\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 19
Accuracy38.3%
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+80}:\\ \;\;\;\;z + \left(t + a\right)\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 20
Accuracy24.0%
Cost196
\[\begin{array}{l} \mathbf{if}\;a \leq 5.2 \cdot 10^{+82}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 21
Accuracy18.3%
Cost64
\[a \]

Error

Reproduce?

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