Average Error: 0.1 → 0.3
Time: 22.7s
Precision: 64
\[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\]
\[\frac{\mathsf{fma}\left(-\log t, \log t, 1\right) \cdot z}{\log t + 1} + \left(\mathsf{fma}\left(b, a - 0.5, x\right) + y\right)\]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\frac{\mathsf{fma}\left(-\log t, \log t, 1\right) \cdot z}{\log t + 1} + \left(\mathsf{fma}\left(b, a - 0.5, x\right) + y\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r281494 = x;
        double r281495 = y;
        double r281496 = r281494 + r281495;
        double r281497 = z;
        double r281498 = r281496 + r281497;
        double r281499 = t;
        double r281500 = log(r281499);
        double r281501 = r281497 * r281500;
        double r281502 = r281498 - r281501;
        double r281503 = a;
        double r281504 = 0.5;
        double r281505 = r281503 - r281504;
        double r281506 = b;
        double r281507 = r281505 * r281506;
        double r281508 = r281502 + r281507;
        return r281508;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r281509 = t;
        double r281510 = log(r281509);
        double r281511 = -r281510;
        double r281512 = 1.0;
        double r281513 = fma(r281511, r281510, r281512);
        double r281514 = z;
        double r281515 = r281513 * r281514;
        double r281516 = r281510 + r281512;
        double r281517 = r281515 / r281516;
        double r281518 = b;
        double r281519 = a;
        double r281520 = 0.5;
        double r281521 = r281519 - r281520;
        double r281522 = x;
        double r281523 = fma(r281518, r281521, r281522);
        double r281524 = y;
        double r281525 = r281523 + r281524;
        double r281526 = r281517 + r281525;
        return r281526;
}

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.3
Herbie0.3
\[\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(b, a - 0.5, x\right) + y\right)}\]
  3. Using strategy rm
  4. Applied fma-udef0.1

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

    \[\leadsto \color{blue}{z \cdot \left(1 - \log t\right)} + \left(\mathsf{fma}\left(b, a - 0.5, x\right) + y\right)\]
  6. Using strategy rm
  7. Applied flip--0.1

    \[\leadsto z \cdot \color{blue}{\frac{1 \cdot 1 - \log t \cdot \log t}{1 + \log t}} + \left(\mathsf{fma}\left(b, a - 0.5, x\right) + y\right)\]
  8. Applied associate-*r/0.3

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

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

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

Reproduce

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