Average Error: 0.1 → 0.1
Time: 20.5s
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(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, 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(1 - \log t, z, \mathsf{fma}\left(a - 0.5, b, x + y\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r216804 = x;
        double r216805 = y;
        double r216806 = r216804 + r216805;
        double r216807 = z;
        double r216808 = r216806 + r216807;
        double r216809 = t;
        double r216810 = log(r216809);
        double r216811 = r216807 * r216810;
        double r216812 = r216808 - r216811;
        double r216813 = a;
        double r216814 = 0.5;
        double r216815 = r216813 - r216814;
        double r216816 = b;
        double r216817 = r216815 * r216816;
        double r216818 = r216812 + r216817;
        return r216818;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r216819 = 1.0;
        double r216820 = t;
        double r216821 = log(r216820);
        double r216822 = r216819 - r216821;
        double r216823 = z;
        double r216824 = a;
        double r216825 = 0.5;
        double r216826 = r216824 - r216825;
        double r216827 = b;
        double r216828 = x;
        double r216829 = y;
        double r216830 = r216828 + r216829;
        double r216831 = fma(r216826, r216827, r216830);
        double r216832 = fma(r216822, r216823, r216831);
        return r216832;
}

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(1 - \log t, z, \mathsf{fma}\left(b, a - 0.5, x\right) + y\right)}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity0.1

    \[\leadsto \mathsf{fma}\left(1 - \log t, z, \mathsf{fma}\left(b, a - 0.5, x\right) + \color{blue}{1 \cdot y}\right)\]
  5. Applied *-un-lft-identity0.1

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

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

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

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

Reproduce

herbie shell --seed 2019179 +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.0 (pow (log t) 2.0)) z) (+ 1.0 (log t)))) (* (- a 0.5) b))

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