Average Error: 0.1 → 0.1
Time: 7.2s
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)\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)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r321939 = x;
        double r321940 = y;
        double r321941 = r321939 + r321940;
        double r321942 = z;
        double r321943 = r321941 + r321942;
        double r321944 = t;
        double r321945 = log(r321944);
        double r321946 = r321942 * r321945;
        double r321947 = r321943 - r321946;
        double r321948 = a;
        double r321949 = 0.5;
        double r321950 = r321948 - r321949;
        double r321951 = b;
        double r321952 = r321950 * r321951;
        double r321953 = r321947 + r321952;
        return r321953;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r321954 = b;
        double r321955 = a;
        double r321956 = 0.5;
        double r321957 = r321955 - r321956;
        double r321958 = z;
        double r321959 = 1.0;
        double r321960 = t;
        double r321961 = log(r321960);
        double r321962 = r321959 - r321961;
        double r321963 = x;
        double r321964 = y;
        double r321965 = r321963 + r321964;
        double r321966 = fma(r321958, r321962, r321965);
        double r321967 = fma(r321954, r321957, r321966);
        return r321967;
}

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. Taylor expanded around 0 0.1

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

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

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

Reproduce

herbie shell --seed 2020036 +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)))