Average Error: 0.1 → 0.1
Time: 6.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)\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 r317572 = x;
        double r317573 = y;
        double r317574 = r317572 + r317573;
        double r317575 = z;
        double r317576 = r317574 + r317575;
        double r317577 = t;
        double r317578 = log(r317577);
        double r317579 = r317575 * r317578;
        double r317580 = r317576 - r317579;
        double r317581 = a;
        double r317582 = 0.5;
        double r317583 = r317581 - r317582;
        double r317584 = b;
        double r317585 = r317583 * r317584;
        double r317586 = r317580 + r317585;
        return r317586;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r317587 = b;
        double r317588 = a;
        double r317589 = 0.5;
        double r317590 = r317588 - r317589;
        double r317591 = z;
        double r317592 = 1.0;
        double r317593 = t;
        double r317594 = log(r317593);
        double r317595 = r317592 - r317594;
        double r317596 = x;
        double r317597 = y;
        double r317598 = r317596 + r317597;
        double r317599 = fma(r317591, r317595, r317598);
        double r317600 = fma(r317587, r317590, r317599);
        return r317600;
}

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 2020100 +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)))