Average Error: 0.1 → 0.1
Time: 5.5s
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 r463162 = x;
        double r463163 = y;
        double r463164 = r463162 + r463163;
        double r463165 = z;
        double r463166 = r463164 + r463165;
        double r463167 = t;
        double r463168 = log(r463167);
        double r463169 = r463165 * r463168;
        double r463170 = r463166 - r463169;
        double r463171 = a;
        double r463172 = 0.5;
        double r463173 = r463171 - r463172;
        double r463174 = b;
        double r463175 = r463173 * r463174;
        double r463176 = r463170 + r463175;
        return r463176;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r463177 = b;
        double r463178 = a;
        double r463179 = 0.5;
        double r463180 = r463178 - r463179;
        double r463181 = z;
        double r463182 = 1.0;
        double r463183 = t;
        double r463184 = log(r463183);
        double r463185 = r463182 - r463184;
        double r463186 = x;
        double r463187 = y;
        double r463188 = r463186 + r463187;
        double r463189 = fma(r463181, r463185, r463188);
        double r463190 = -r463181;
        double r463191 = r463190 + r463181;
        double r463192 = r463184 * r463191;
        double r463193 = r463189 + r463192;
        double r463194 = fma(r463177, r463180, r463193);
        return r463194;
}

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-sqrt31.9

    \[\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-diff31.9

    \[\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 2020060 +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)))