Average Error: 0.1 → 0.1
Time: 27.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, z - \log t \cdot z\right) + \left(y + x\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, z - \log t \cdot z\right) + \left(y + x\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r18930898 = x;
        double r18930899 = y;
        double r18930900 = r18930898 + r18930899;
        double r18930901 = z;
        double r18930902 = r18930900 + r18930901;
        double r18930903 = t;
        double r18930904 = log(r18930903);
        double r18930905 = r18930901 * r18930904;
        double r18930906 = r18930902 - r18930905;
        double r18930907 = a;
        double r18930908 = 0.5;
        double r18930909 = r18930907 - r18930908;
        double r18930910 = b;
        double r18930911 = r18930909 * r18930910;
        double r18930912 = r18930906 + r18930911;
        return r18930912;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r18930913 = b;
        double r18930914 = a;
        double r18930915 = 0.5;
        double r18930916 = r18930914 - r18930915;
        double r18930917 = z;
        double r18930918 = t;
        double r18930919 = log(r18930918);
        double r18930920 = r18930919 * r18930917;
        double r18930921 = r18930917 - r18930920;
        double r18930922 = fma(r18930913, r18930916, r18930921);
        double r18930923 = y;
        double r18930924 = x;
        double r18930925 = r18930923 + r18930924;
        double r18930926 = r18930922 + r18930925;
        return r18930926;
}

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. Using strategy rm
  3. Applied associate--l+0.1

    \[\leadsto \color{blue}{\left(\left(x + y\right) + \left(z - z \cdot \log t\right)\right)} + \left(a - 0.5\right) \cdot b\]
  4. Applied associate-+l+0.1

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

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

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

Reproduce

herbie shell --seed 2019164 +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 (pow (log t) 2)) z) (+ 1 (log t)))) (* (- a 0.5) b))

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