Average Error: 0.1 → 0.1
Time: 1.4m
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(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, y + x\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(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, y + x\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r16948486 = x;
        double r16948487 = y;
        double r16948488 = r16948486 + r16948487;
        double r16948489 = z;
        double r16948490 = r16948488 + r16948489;
        double r16948491 = t;
        double r16948492 = log(r16948491);
        double r16948493 = r16948489 * r16948492;
        double r16948494 = r16948490 - r16948493;
        double r16948495 = a;
        double r16948496 = 0.5;
        double r16948497 = r16948495 - r16948496;
        double r16948498 = b;
        double r16948499 = r16948497 * r16948498;
        double r16948500 = r16948494 + r16948499;
        return r16948500;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r16948501 = 1.0;
        double r16948502 = t;
        double r16948503 = log(r16948502);
        double r16948504 = r16948501 - r16948503;
        double r16948505 = z;
        double r16948506 = a;
        double r16948507 = 0.5;
        double r16948508 = r16948506 - r16948507;
        double r16948509 = b;
        double r16948510 = y;
        double r16948511 = x;
        double r16948512 = r16948510 + r16948511;
        double r16948513 = fma(r16948508, r16948509, r16948512);
        double r16948514 = fma(r16948504, r16948505, r16948513);
        return r16948514;
}

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(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, x + y\right)\right)}\]
  3. Final simplification0.1

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

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, A"

  :herbie-target
  (+ (+ (+ x y) (/ (* (- 1.0 (pow (log t) 2.0)) z) (+ 1.0 (log t)))) (* (- a 0.5) b))

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