Average Error: 0.1 → 0.1
Time: 6.1s
Precision: 64
\[\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) + \log t \cdot \left(\left(-z\right) + z\right)\right)\]
\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) + \log t \cdot \left(\left(-z\right) + z\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r440835 = x;
        double r440836 = y;
        double r440837 = r440835 + r440836;
        double r440838 = z;
        double r440839 = r440837 + r440838;
        double r440840 = t;
        double r440841 = log(r440840);
        double r440842 = r440838 * r440841;
        double r440843 = r440839 - r440842;
        double r440844 = a;
        double r440845 = 0.5;
        double r440846 = r440844 - r440845;
        double r440847 = b;
        double r440848 = r440846 * r440847;
        double r440849 = r440843 + r440848;
        return r440849;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r440850 = b;
        double r440851 = a;
        double r440852 = 0.5;
        double r440853 = r440851 - r440852;
        double r440854 = z;
        double r440855 = 1.0;
        double r440856 = t;
        double r440857 = log(r440856);
        double r440858 = r440855 - r440857;
        double r440859 = x;
        double r440860 = y;
        double r440861 = r440859 + r440860;
        double r440862 = fma(r440854, r440858, r440861);
        double r440863 = -r440854;
        double r440864 = r440863 + r440854;
        double r440865 = r440857 * r440864;
        double r440866 = r440862 + r440865;
        double r440867 = fma(r440850, r440853, r440866);
        return r440867;
}

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 - {\left(\log t\right)}^{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, \left(\left(x + y\right) + z\right) - z \cdot \log t\right)}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt32.6

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

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

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

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

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

Reproduce

herbie shell --seed 2019362 +o rules:numerics
(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 (pow (log t) 2)) z) (+ 1 (log t)))) (* (- a 0.5) b))

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