Average Error: 0.1 → 0.1
Time: 6.7s
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 r360097 = x;
        double r360098 = y;
        double r360099 = r360097 + r360098;
        double r360100 = z;
        double r360101 = r360099 + r360100;
        double r360102 = t;
        double r360103 = log(r360102);
        double r360104 = r360100 * r360103;
        double r360105 = r360101 - r360104;
        double r360106 = a;
        double r360107 = 0.5;
        double r360108 = r360106 - r360107;
        double r360109 = b;
        double r360110 = r360108 * r360109;
        double r360111 = r360105 + r360110;
        return r360111;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r360112 = b;
        double r360113 = a;
        double r360114 = 0.5;
        double r360115 = r360113 - r360114;
        double r360116 = z;
        double r360117 = 1.0;
        double r360118 = t;
        double r360119 = log(r360118);
        double r360120 = r360117 - r360119;
        double r360121 = x;
        double r360122 = y;
        double r360123 = r360121 + r360122;
        double r360124 = fma(r360116, r360120, r360123);
        double r360125 = fma(r360112, r360115, r360124);
        return r360125;
}

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