?

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

    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)} \]

    associate-+l+ [=>]99.8

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

    associate-+l+ [=>]99.8

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

    fma-def [=>]99.8

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

    associate-+r+ [=>]99.8

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

    +-commutative [=>]99.8

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

    associate-+l+ [=>]99.8

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

    fma-def [=>]99.8

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

    sub-neg [=>]99.8

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

    metadata-eval [=>]99.8

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

    +-commutative [=>]99.8

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

    fma-def [=>]99.8

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

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

Alternatives

Alternative 1
Accuracy95.4%
Cost14025
\[\begin{array}{l} t_1 := \log c \cdot \left(b + -0.5\right)\\ \mathbf{if}\;x \leq -5.1 \cdot 10^{+70} \lor \neg \left(x \leq 5.5 \cdot 10^{+149}\right):\\ \;\;\;\;a + \left(x \cdot \log y + \left(t_1 + \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 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.4%
Cost13897
\[\begin{array}{l} t_1 := \log c \cdot \left(b + -0.5\right)\\ \mathbf{if}\;x \leq -2 \cdot 10^{+72} \lor \neg \left(x \leq 2.9 \cdot 10^{+196}\right):\\ \;\;\;\;a + \left(x \cdot \log y + \left(z + t_1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(t_1 + \left(z + \left(t + a\right)\right)\right)\\ \end{array} \]
Alternative 4
Accuracy91.8%
Cost13380
\[\begin{array}{l} \mathbf{if}\;x \leq -1.05 \cdot 10^{+133}:\\ \;\;\;\;\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\\ \mathbf{elif}\;x \leq 2 \cdot 10^{+223}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b + -0.5\right) + \left(z + \left(t + a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a + \left(z + x \cdot \log y\right)\\ \end{array} \]
Alternative 5
Accuracy90.5%
Cost7625
\[\begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{+135} \lor \neg \left(x \leq 1.1 \cdot 10^{+223}\right):\\ \;\;\;\;a + \left(z + x \cdot \log y\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 6
Accuracy80.0%
Cost7369
\[\begin{array}{l} \mathbf{if}\;x \leq -1.08 \cdot 10^{+132} \lor \neg \left(x \leq 1.95 \cdot 10^{+223}\right):\\ \;\;\;\;a + \left(z + x \cdot \log y\right)\\ \mathbf{else}:\\ \;\;\;\;a + \left(\log c \cdot \left(b + -0.5\right) + \left(z + t\right)\right)\\ \end{array} \]
Alternative 7
Accuracy45.7%
Cost7248
\[\begin{array}{l} t_1 := a + x \cdot \log y\\ \mathbf{if}\;x \leq -5.5 \cdot 10^{+139}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{-237}:\\ \;\;\;\;z + a\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-305}:\\ \;\;\;\;a + y \cdot i\\ \mathbf{elif}\;x \leq 2.45 \cdot 10^{+219}:\\ \;\;\;\;z + a\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Accuracy46.8%
Cost7248
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.52 \cdot 10^{+144}:\\ \;\;\;\;a + \left(t + t_1\right)\\ \mathbf{elif}\;x \leq -1 \cdot 10^{-236}:\\ \;\;\;\;z + a\\ \mathbf{elif}\;x \leq -2.5 \cdot 10^{-307}:\\ \;\;\;\;a + y \cdot i\\ \mathbf{elif}\;x \leq 2.45 \cdot 10^{+219}:\\ \;\;\;\;z + a\\ \mathbf{else}:\\ \;\;\;\;a + t_1\\ \end{array} \]
Alternative 9
Accuracy50.6%
Cost7245
\[\begin{array}{l} \mathbf{if}\;y \leq 1.25 \cdot 10^{+23} \lor \neg \left(y \leq 1.15 \cdot 10^{+54}\right) \land y \leq 7.2 \cdot 10^{+188}:\\ \;\;\;\;a + \left(z + x \cdot \log y\right)\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 10
Accuracy57.9%
Cost7113
\[\begin{array}{l} \mathbf{if}\;b \leq -1.3 \cdot 10^{+273} \lor \neg \left(b \leq 8 \cdot 10^{+206}\right):\\ \;\;\;\;y \cdot i + b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;a + \left(z + x \cdot \log y\right)\\ \end{array} \]
Alternative 11
Accuracy34.8%
Cost457
\[\begin{array}{l} \mathbf{if}\;t \leq 5.2 \cdot 10^{-282} \lor \neg \left(t \leq 3.1 \cdot 10^{-227}\right):\\ \;\;\;\;z + a\\ \mathbf{else}:\\ \;\;\;\;y \cdot i\\ \end{array} \]
Alternative 12
Accuracy36.6%
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq -2.75 \cdot 10^{+87}:\\ \;\;\;\;z + a\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 13
Accuracy25.2%
Cost196
\[\begin{array}{l} \mathbf{if}\;a \leq 1.6 \cdot 10^{+153}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 14
Accuracy18.7%
Cost64
\[a \]

Error

Reproduce?

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