Average Error: 0.1 → 0.1
Time: 5.1s
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, \log \left(\frac{e^{1}}{t}\right), x + y\right) + \log t \cdot \left(\left(-z\right) + z\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, \log \left(\frac{e^{1}}{t}\right), x + y\right) + \log t \cdot \left(\left(-z\right) + z\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r341034 = x;
        double r341035 = y;
        double r341036 = r341034 + r341035;
        double r341037 = z;
        double r341038 = r341036 + r341037;
        double r341039 = t;
        double r341040 = log(r341039);
        double r341041 = r341037 * r341040;
        double r341042 = r341038 - r341041;
        double r341043 = a;
        double r341044 = 0.5;
        double r341045 = r341043 - r341044;
        double r341046 = b;
        double r341047 = r341045 * r341046;
        double r341048 = r341042 + r341047;
        return r341048;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r341049 = b;
        double r341050 = a;
        double r341051 = 0.5;
        double r341052 = r341050 - r341051;
        double r341053 = z;
        double r341054 = 1.0;
        double r341055 = exp(r341054);
        double r341056 = t;
        double r341057 = r341055 / r341056;
        double r341058 = log(r341057);
        double r341059 = x;
        double r341060 = y;
        double r341061 = r341059 + r341060;
        double r341062 = fma(r341053, r341058, r341061);
        double r341063 = log(r341056);
        double r341064 = -r341053;
        double r341065 = r341064 + r341053;
        double r341066 = r341063 * r341065;
        double r341067 = r341062 + r341066;
        double r341068 = fma(r341049, r341052, r341067);
        return r341068;
}

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. Using strategy rm
  4. Applied add-sqr-sqrt32.4

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

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

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

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

    \[\leadsto \mathsf{fma}\left(b, a - 0.5, \mathsf{fma}\left(z, \color{blue}{\log \left(e^{1}\right)} - \log t, x + y\right) + \log t \cdot \left(\left(-z\right) + z\right)\right)\]
  10. Applied diff-log0.1

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

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

Reproduce

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