Average Error: 0.1 → 0.1
Time: 29.5s
Precision: binary64
Cost: 19904
\[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
\[\mathsf{fma}\left(b, a + -0.5, \mathsf{fma}\left(z, 1 - \log t, x + y\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 b (+ a -0.5) (fma z (- 1.0 (log t)) (+ x y))))
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(b, (a + -0.5), fma(z, (1.0 - log(t)), (x + y)));
}
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(b, Float64(a + -0.5), fma(z, Float64(1.0 - log(t)), Float64(x + y)))
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[(b * N[(a + -0.5), $MachinePrecision] + N[(z * N[(1.0 - N[Log[t], $MachinePrecision]), $MachinePrecision] + N[(x + y), $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(b, a + -0.5, \mathsf{fma}\left(z, 1 - \log t, x + y\right)\right)

Error

Target

Original0.1
Target0.3
Herbie0.1
\[\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 0.1

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

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

Alternatives

Alternative 1
Error0.7
Cost7752
\[\begin{array}{l} t_1 := z \cdot \log t\\ \mathbf{if}\;a - 0.5 \leq -2000:\\ \;\;\;\;\left(\left(x + y\right) + z \cdot \left(1 - \log t\right)\right) + a \cdot b\\ \mathbf{elif}\;a - 0.5 \leq -0.5:\\ \;\;\;\;\left(-0.5 \cdot b + \left(y + \left(z + x\right)\right)\right) - t_1\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(x + y\right) + z\right) - t_1\right) + a \cdot b\\ \end{array} \]
Alternative 2
Error4.8
Cost7496
\[\begin{array}{l} t_1 := \left(\left(x + y\right) + z \cdot \left(1 - \log t\right)\right) + a \cdot b\\ \mathbf{if}\;z \leq -1.22 \cdot 10^{+119}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-24}:\\ \;\;\;\;\left(y + x\right) + \left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error0.1
Cost7360
\[\left(\left(x + y\right) + z \cdot \left(1 - \log t\right)\right) + \left(a - 0.5\right) \cdot b \]
Alternative 4
Error7.2
Cost7240
\[\begin{array}{l} t_1 := \left(1 - \log t\right) \cdot z + \left(y + x\right)\\ \mathbf{if}\;z \leq -1.9 \cdot 10^{+119}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 0.0115:\\ \;\;\;\;\left(y + x\right) + \left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error9.0
Cost7112
\[\begin{array}{l} t_1 := \left(1 - \log t\right) \cdot z + x\\ \mathbf{if}\;z \leq -4.3 \cdot 10^{+120}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+114}:\\ \;\;\;\;\left(y + x\right) + \left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error9.2
Cost7112
\[\begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{+121}:\\ \;\;\;\;\left(y + z\right) - z \cdot \log t\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{+109}:\\ \;\;\;\;\left(y + x\right) + \left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \log t\right) \cdot z + x\\ \end{array} \]
Alternative 7
Error11.3
Cost6984
\[\begin{array}{l} t_1 := \left(1 - \log t\right) \cdot z\\ \mathbf{if}\;z \leq -4.8 \cdot 10^{+121}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+121}:\\ \;\;\;\;\left(y + x\right) + \left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error11.2
Cost6984
\[\begin{array}{l} \mathbf{if}\;z \leq -8.8 \cdot 10^{+120}:\\ \;\;\;\;\left(1 - \log t\right) \cdot z\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{+123}:\\ \;\;\;\;\left(y + x\right) + \left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;z - z \cdot \log t\\ \end{array} \]
Alternative 9
Error40.9
Cost1120
\[\begin{array}{l} \mathbf{if}\;y \leq -3.5 \cdot 10^{+140}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -3.2 \cdot 10^{+64}:\\ \;\;\;\;-0.5 \cdot b\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{+24}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -3.2 \cdot 10^{-305}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-227}:\\ \;\;\;\;-0.5 \cdot b\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-118}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 6.6 \cdot 10^{-40}:\\ \;\;\;\;-0.5 \cdot b\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+22}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 10
Error38.2
Cost1116
\[\begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ \mathbf{if}\;x \leq -1.4 \cdot 10^{+26}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -5.7 \cdot 10^{-225}:\\ \;\;\;\;y\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{-300}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-258}:\\ \;\;\;\;y\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-30}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.05 \cdot 10^{+33}:\\ \;\;\;\;y\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{+43}:\\ \;\;\;\;-0.5 \cdot b\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 11
Error31.1
Cost980
\[\begin{array}{l} t_1 := -0.5 \cdot b + y\\ t_2 := -0.5 \cdot b + x\\ \mathbf{if}\;x \leq -3.8 \cdot 10^{+25}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.32 \cdot 10^{-129}:\\ \;\;\;\;y + a \cdot b\\ \mathbf{elif}\;x \leq -5.5 \cdot 10^{-225}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -4.6 \cdot 10^{-303}:\\ \;\;\;\;\left(a - 0.5\right) \cdot b\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{+34}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 12
Error30.9
Cost980
\[\begin{array}{l} t_1 := -0.5 \cdot b + y\\ \mathbf{if}\;x \leq -9.5 \cdot 10^{+25}:\\ \;\;\;\;-0.5 \cdot b + x\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-131}:\\ \;\;\;\;y + a \cdot b\\ \mathbf{elif}\;x \leq -1.5 \cdot 10^{-224}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-303}:\\ \;\;\;\;\left(a - 0.5\right) \cdot b\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+44}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot b + x\\ \end{array} \]
Alternative 13
Error33.7
Cost848
\[\begin{array}{l} t_1 := y + a \cdot b\\ \mathbf{if}\;x \leq -2.05 \cdot 10^{+26}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.7 \cdot 10^{-182}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.85 \cdot 10^{-75}:\\ \;\;\;\;\left(a - 0.5\right) \cdot b\\ \mathbf{elif}\;x \leq 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 14
Error31.3
Cost848
\[\begin{array}{l} t_1 := y + a \cdot b\\ t_2 := -0.5 \cdot b + x\\ \mathbf{if}\;x \leq -3.2 \cdot 10^{+25}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-181}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.18 \cdot 10^{-79}:\\ \;\;\;\;\left(a - 0.5\right) \cdot b\\ \mathbf{elif}\;x \leq 8.6 \cdot 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 15
Error23.2
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -3.9 \cdot 10^{+145}:\\ \;\;\;\;-0.5 \cdot b + y\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{+65}:\\ \;\;\;\;x + \left(a - 0.5\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;y + a \cdot b\\ \end{array} \]
Alternative 16
Error21.6
Cost712
\[\begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ t_2 := x + t_1\\ \mathbf{if}\;x \leq -2 \cdot 10^{+26}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{+34}:\\ \;\;\;\;y + t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 17
Error20.7
Cost712
\[\begin{array}{l} t_1 := \left(a - 0.5\right) \cdot b\\ \mathbf{if}\;x \leq -8 \cdot 10^{+25}:\\ \;\;\;\;x + t_1\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{+44}:\\ \;\;\;\;y + t_1\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) + a \cdot b\\ \end{array} \]
Alternative 18
Error15.8
Cost576
\[\left(y + x\right) + \left(a - 0.5\right) \cdot b \]
Alternative 19
Error39.0
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+26}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+36}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 20
Error47.8
Cost64
\[x \]

Error

Reproduce

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