?

Average Accuracy: 99.8% → 99.8%
Time: 21.1s
Precision: binary64
Cost: 13632

?

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

Error?

Target

Original99.8%
Target99.4%
Herbie99.8%
\[\left(\left(x + y\right) + \frac{\left(1 - {\log t}^{2}\right) \cdot z}{1 + \log t}\right) + \left(a - 0.5\right) \cdot b \]

Derivation?

  1. Initial program 99.8%

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

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

    [Start]99.8

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

    +-commutative [=>]99.8

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

    fma-def [=>]99.9

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

    sub-neg [=>]99.9

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

    metadata-eval [=>]99.9

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

    +-commutative [=>]99.9

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

    associate--l+ [=>]99.8

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

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

Alternatives

Alternative 1
Accuracy90.6%
Cost7364
\[\begin{array}{l} t_1 := z \cdot \log t\\ t_2 := \left(a + -0.5\right) \cdot b\\ \mathbf{if}\;z \leq -3.5 \cdot 10^{+75}:\\ \;\;\;\;\left(t_2 + \left(z + x\right)\right) - t_1\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+133}:\\ \;\;\;\;t_2 + \left(z + \left(x + y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y + \left(z + x\right)\right) - t_1\\ \end{array} \]
Alternative 2
Accuracy99.8%
Cost7360
\[\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right) + \left(a + -0.5\right) \cdot b \]
Alternative 3
Accuracy89.6%
Cost7241
\[\begin{array}{l} \mathbf{if}\;z \leq -7.5 \cdot 10^{+73} \lor \neg \left(z \leq 2.4 \cdot 10^{+136}\right):\\ \;\;\;\;\left(y + \left(z + x\right)\right) - z \cdot \log t\\ \mathbf{else}:\\ \;\;\;\;\left(a + -0.5\right) \cdot b + \left(z + \left(x + y\right)\right)\\ \end{array} \]
Alternative 4
Accuracy85.1%
Cost7113
\[\begin{array}{l} \mathbf{if}\;z \leq -4.4 \cdot 10^{+203} \lor \neg \left(z \leq 2.3 \cdot 10^{+231}\right):\\ \;\;\;\;x + z \cdot \left(1 - \log t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a + -0.5\right) \cdot b + \left(z + \left(x + y\right)\right)\\ \end{array} \]
Alternative 5
Accuracy85.1%
Cost7113
\[\begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{+200} \lor \neg \left(z \leq 2.3 \cdot 10^{+231}\right):\\ \;\;\;\;x + \left(z - z \cdot \log t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a + -0.5\right) \cdot b + \left(z + \left(x + y\right)\right)\\ \end{array} \]
Alternative 6
Accuracy85.7%
Cost7112
\[\begin{array}{l} t_1 := z \cdot \log t\\ \mathbf{if}\;z \leq -1 \cdot 10^{+134}:\\ \;\;\;\;\left(z + y\right) - t_1\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{+231}:\\ \;\;\;\;\left(a + -0.5\right) \cdot b + \left(z + \left(x + y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(z - t_1\right)\\ \end{array} \]
Alternative 7
Accuracy84.2%
Cost6985
\[\begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{+202} \lor \neg \left(z \leq 2.3 \cdot 10^{+231}\right):\\ \;\;\;\;z \cdot \left(1 - \log t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a + -0.5\right) \cdot b + \left(z + \left(x + y\right)\right)\\ \end{array} \]
Alternative 8
Accuracy84.1%
Cost6985
\[\begin{array}{l} \mathbf{if}\;z \leq -6.5 \cdot 10^{+213} \lor \neg \left(z \leq 2.4 \cdot 10^{+231}\right):\\ \;\;\;\;z - z \cdot \log t\\ \mathbf{else}:\\ \;\;\;\;\left(a + -0.5\right) \cdot b + \left(z + \left(x + y\right)\right)\\ \end{array} \]
Alternative 9
Accuracy58.6%
Cost1874
\[\begin{array}{l} t_1 := \left(a + -0.5\right) \cdot b\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+204} \lor \neg \left(t_1 \leq -2 \cdot 10^{+114}\right) \land \left(t_1 \leq -5 \cdot 10^{+62} \lor \neg \left(t_1 \leq 10^{+187}\right)\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 10
Accuracy43.1%
Cost1360
\[\begin{array}{l} t_1 := x + -0.5 \cdot b\\ \mathbf{if}\;x + y \leq -5 \cdot 10^{+176}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x + y \leq -2 \cdot 10^{+138}:\\ \;\;\;\;x + a \cdot b\\ \mathbf{elif}\;x + y \leq -1 \cdot 10^{-25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x + y \leq 2000000000000:\\ \;\;\;\;\left(a + -0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y + a \cdot b\\ \end{array} \]
Alternative 11
Accuracy47.0%
Cost1232
\[\begin{array}{l} \mathbf{if}\;x + y \leq -2 \cdot 10^{+168}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;x + y \leq -2 \cdot 10^{+138}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;x + y \leq -1 \cdot 10^{-25}:\\ \;\;\;\;x\\ \mathbf{elif}\;x + y \leq 2 \cdot 10^{+42}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 12
Accuracy43.3%
Cost840
\[\begin{array}{l} \mathbf{if}\;x + y \leq -1 \cdot 10^{-25}:\\ \;\;\;\;x + a \cdot b\\ \mathbf{elif}\;x + y \leq 2000000000000:\\ \;\;\;\;\left(a + -0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y + a \cdot b\\ \end{array} \]
Alternative 13
Accuracy29.1%
Cost720
\[\begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{+159}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -7.6 \cdot 10^{+127}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;x \leq -8.8 \cdot 10^{-65}:\\ \;\;\;\;y\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-161}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 14
Accuracy48.5%
Cost708
\[\begin{array}{l} \mathbf{if}\;x + y \leq 2000000000000:\\ \;\;\;\;x + \left(a + -0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y + a \cdot b\\ \end{array} \]
Alternative 15
Accuracy52.5%
Cost708
\[\begin{array}{l} t_1 := \left(a + -0.5\right) \cdot b\\ \mathbf{if}\;x + y \leq 5 \cdot 10^{-69}:\\ \;\;\;\;x + t_1\\ \mathbf{else}:\\ \;\;\;\;y + t_1\\ \end{array} \]
Alternative 16
Accuracy76.5%
Cost704
\[\left(a + -0.5\right) \cdot b + \left(z + \left(x + y\right)\right) \]
Alternative 17
Accuracy31.8%
Cost460
\[\begin{array}{l} \mathbf{if}\;y \leq 2.6 \cdot 10^{-6}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{+54}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+105}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 18
Accuracy30.9%
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq 5.4 \cdot 10^{-134}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{+49}:\\ \;\;\;\;-0.5 \cdot b\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 19
Accuracy25.1%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023141 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (+ (+ (+ x y) (/ (* (- 1.0 (pow (log t) 2.0)) z) (+ 1.0 (log t)))) (* (- a 0.5) b))

  (+ (- (+ (+ x y) z) (* z (log t))) (* (- a 0.5) b)))