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

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

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(z, 1 - \log t, \mathsf{fma}\left(a - 0.5, b, x + y\right)\right)} \]
  3. Taylor expanded in z around 0 0.1

    \[\leadsto \color{blue}{\left(a \cdot b + \left(y + \left(z + x\right)\right)\right) - \left(z \cdot \log t + 0.5 \cdot b\right)} \]
  4. Applied add-cube-cbrt_binary640.5

    \[\leadsto \left(a \cdot b + \left(y + \left(z + x\right)\right)\right) - \color{blue}{\left(\sqrt[3]{z \cdot \log t + 0.5 \cdot b} \cdot \sqrt[3]{z \cdot \log t + 0.5 \cdot b}\right) \cdot \sqrt[3]{z \cdot \log t + 0.5 \cdot b}} \]
  5. Applied add-cube-cbrt_binary641.3

    \[\leadsto \color{blue}{\left(\sqrt[3]{a \cdot b + \left(y + \left(z + x\right)\right)} \cdot \sqrt[3]{a \cdot b + \left(y + \left(z + x\right)\right)}\right) \cdot \sqrt[3]{a \cdot b + \left(y + \left(z + x\right)\right)}} - \left(\sqrt[3]{z \cdot \log t + 0.5 \cdot b} \cdot \sqrt[3]{z \cdot \log t + 0.5 \cdot b}\right) \cdot \sqrt[3]{z \cdot \log t + 0.5 \cdot b} \]
  6. Applied prod-diff_binary641.3

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt[3]{a \cdot b + \left(y + \left(z + x\right)\right)} \cdot \sqrt[3]{a \cdot b + \left(y + \left(z + x\right)\right)}, \sqrt[3]{a \cdot b + \left(y + \left(z + x\right)\right)}, -\sqrt[3]{z \cdot \log t + 0.5 \cdot b} \cdot \left(\sqrt[3]{z \cdot \log t + 0.5 \cdot b} \cdot \sqrt[3]{z \cdot \log t + 0.5 \cdot b}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{z \cdot \log t + 0.5 \cdot b}, \sqrt[3]{z \cdot \log t + 0.5 \cdot b} \cdot \sqrt[3]{z \cdot \log t + 0.5 \cdot b}, \sqrt[3]{z \cdot \log t + 0.5 \cdot b} \cdot \left(\sqrt[3]{z \cdot \log t + 0.5 \cdot b} \cdot \sqrt[3]{z \cdot \log t + 0.5 \cdot b}\right)\right)} \]
  7. Simplified0.1

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

    \[\leadsto \mathsf{fma}\left(b, a, \left(y + \left(z + x\right)\right) - \mathsf{fma}\left(z, \log t, 0.5 \cdot b\right)\right) + \color{blue}{0} \]
  9. Final simplification0.1

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

Reproduce

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