Average Error: 0.1 → 0.1
Time: 20.4s
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, \left(z + y\right) - \log t \cdot z\right) + x\]
\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, \left(z + y\right) - \log t \cdot z\right) + x
double f(double x, double y, double z, double t, double a, double b) {
        double r327086 = x;
        double r327087 = y;
        double r327088 = r327086 + r327087;
        double r327089 = z;
        double r327090 = r327088 + r327089;
        double r327091 = t;
        double r327092 = log(r327091);
        double r327093 = r327089 * r327092;
        double r327094 = r327090 - r327093;
        double r327095 = a;
        double r327096 = 0.5;
        double r327097 = r327095 - r327096;
        double r327098 = b;
        double r327099 = r327097 * r327098;
        double r327100 = r327094 + r327099;
        return r327100;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r327101 = b;
        double r327102 = a;
        double r327103 = 0.5;
        double r327104 = r327102 - r327103;
        double r327105 = z;
        double r327106 = y;
        double r327107 = r327105 + r327106;
        double r327108 = t;
        double r327109 = log(r327108);
        double r327110 = r327109 * r327105;
        double r327111 = r327107 - r327110;
        double r327112 = fma(r327101, r327104, r327111);
        double r327113 = x;
        double r327114 = r327112 + r327113;
        return r327114;
}

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, \mathsf{fma}\left(1 - \log t, z, y\right)\right) + x}\]
  3. Taylor expanded around 0 0.1

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

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

Reproduce

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