Average Error: 0.1 → 0.1
Time: 5.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, \log \left(\frac{e^{1}}{t}\right), 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, \log \left(\frac{e^{1}}{t}\right), 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 r305316 = x;
        double r305317 = y;
        double r305318 = r305316 + r305317;
        double r305319 = z;
        double r305320 = r305318 + r305319;
        double r305321 = t;
        double r305322 = log(r305321);
        double r305323 = r305319 * r305322;
        double r305324 = r305320 - r305323;
        double r305325 = a;
        double r305326 = 0.5;
        double r305327 = r305325 - r305326;
        double r305328 = b;
        double r305329 = r305327 * r305328;
        double r305330 = r305324 + r305329;
        return r305330;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r305331 = b;
        double r305332 = a;
        double r305333 = 0.5;
        double r305334 = r305332 - r305333;
        double r305335 = z;
        double r305336 = 1.0;
        double r305337 = exp(r305336);
        double r305338 = t;
        double r305339 = r305337 / r305338;
        double r305340 = log(r305339);
        double r305341 = x;
        double r305342 = y;
        double r305343 = r305341 + r305342;
        double r305344 = fma(r305335, r305340, r305343);
        double r305345 = log(r305338);
        double r305346 = -r305335;
        double r305347 = r305346 + r305335;
        double r305348 = r305345 * r305347;
        double r305349 = r305344 + r305348;
        double r305350 = fma(r305331, r305334, r305349);
        return r305350;
}

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.4

    \[\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.4

    \[\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. Using strategy rm
  9. Applied add-log-exp0.1

    \[\leadsto \mathsf{fma}\left(b, a - 0.5, \mathsf{fma}\left(z, \color{blue}{\log \left(e^{1}\right)} - \log t, x + y\right) + \log t \cdot \left(\left(-z\right) + z\right)\right)\]
  10. Applied diff-log0.1

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

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

Reproduce

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