Average Error: 0.1 → 0.1
Time: 9.7s
Precision: binary64
\[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b \]
\[\begin{array}{l} t_1 := \log \left(\sqrt{t}\right)\\ \left(\left(1 - t_1\right) \cdot z - t_1 \cdot z\right) + \mathsf{fma}\left(a - 0.5, b, x + y\right) \end{array} \]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\begin{array}{l}
t_1 := \log \left(\sqrt{t}\right)\\
\left(\left(1 - t_1\right) \cdot z - t_1 \cdot z\right) + \mathsf{fma}\left(a - 0.5, b, x + y\right)
\end{array}
(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
 (let* ((t_1 (log (sqrt t))))
   (+ (- (* (- 1.0 t_1) z) (* t_1 z)) (fma (- a 0.5) b (+ 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) {
	double t_1 = log(sqrt(t));
	return (((1.0 - t_1) * z) - (t_1 * z)) + fma((a - 0.5), b, (x + y));
}

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.4
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. Applied fma-udef_binary640.1

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

    \[\leadsto \color{blue}{\left(z - z \cdot \log t\right)} + \mathsf{fma}\left(a - 0.5, b, x + y\right) \]
  5. Applied add-sqr-sqrt_binary640.1

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

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

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

    \[\leadsto \color{blue}{\left(\left(z - \log \left(\sqrt{t}\right) \cdot z\right) - \log \left(\sqrt{t}\right) \cdot z\right)} + \mathsf{fma}\left(a - 0.5, b, x + y\right) \]
  9. Taylor expanded in z around 0 0.1

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

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

Reproduce

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