Average Error: 0.1 → 0.1
Time: 5.8s
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 r349701 = x;
        double r349702 = y;
        double r349703 = r349701 + r349702;
        double r349704 = z;
        double r349705 = r349703 + r349704;
        double r349706 = t;
        double r349707 = log(r349706);
        double r349708 = r349704 * r349707;
        double r349709 = r349705 - r349708;
        double r349710 = a;
        double r349711 = 0.5;
        double r349712 = r349710 - r349711;
        double r349713 = b;
        double r349714 = r349712 * r349713;
        double r349715 = r349709 + r349714;
        return r349715;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r349716 = b;
        double r349717 = a;
        double r349718 = 0.5;
        double r349719 = r349717 - r349718;
        double r349720 = z;
        double r349721 = 1.0;
        double r349722 = t;
        double r349723 = log(r349722);
        double r349724 = r349721 - r349723;
        double r349725 = x;
        double r349726 = y;
        double r349727 = r349725 + r349726;
        double r349728 = fma(r349720, r349724, r349727);
        double r349729 = fma(r349716, r349719, r349728);
        return r349729;
}

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, \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 2020046 +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)))