Average Error: 0.1 → 0.1
Time: 14.6s
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, x + y\right) - \mathsf{fma}\left(z, \log t, -z\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, x + y\right) - \mathsf{fma}\left(z, \log t, -z\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r6276324 = x;
        double r6276325 = y;
        double r6276326 = r6276324 + r6276325;
        double r6276327 = z;
        double r6276328 = r6276326 + r6276327;
        double r6276329 = t;
        double r6276330 = log(r6276329);
        double r6276331 = r6276327 * r6276330;
        double r6276332 = r6276328 - r6276331;
        double r6276333 = a;
        double r6276334 = 0.5;
        double r6276335 = r6276333 - r6276334;
        double r6276336 = b;
        double r6276337 = r6276335 * r6276336;
        double r6276338 = r6276332 + r6276337;
        return r6276338;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r6276339 = b;
        double r6276340 = a;
        double r6276341 = 0.5;
        double r6276342 = r6276340 - r6276341;
        double r6276343 = x;
        double r6276344 = y;
        double r6276345 = r6276343 + r6276344;
        double r6276346 = fma(r6276339, r6276342, r6276345);
        double r6276347 = z;
        double r6276348 = t;
        double r6276349 = log(r6276348);
        double r6276350 = -r6276347;
        double r6276351 = fma(r6276347, r6276349, r6276350);
        double r6276352 = r6276346 - r6276351;
        return r6276352;
}

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.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, y + x\right) - \left(z \cdot \log t - z\right)}\]
  3. Using strategy rm
  4. Applied fma-neg0.1

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

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

Reproduce

herbie shell --seed 2019156 +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 (pow (log t) 2)) z) (+ 1 (log t)))) (* (- a 0.5) b))

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