Average Error: 0.1 → 0.1
Time: 9.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 r1948 = x;
        double r1949 = y;
        double r1950 = r1948 + r1949;
        double r1951 = z;
        double r1952 = r1950 + r1951;
        double r1953 = t;
        double r1954 = log(r1953);
        double r1955 = r1951 * r1954;
        double r1956 = r1952 - r1955;
        double r1957 = a;
        double r1958 = 0.5;
        double r1959 = r1957 - r1958;
        double r1960 = b;
        double r1961 = r1959 * r1960;
        double r1962 = r1956 + r1961;
        return r1962;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r1963 = b;
        double r1964 = a;
        double r1965 = 0.5;
        double r1966 = r1964 - r1965;
        double r1967 = z;
        double r1968 = 1.0;
        double r1969 = t;
        double r1970 = log(r1969);
        double r1971 = r1968 - r1970;
        double r1972 = x;
        double r1973 = y;
        double r1974 = r1972 + r1973;
        double r1975 = fma(r1967, r1971, r1974);
        double r1976 = fma(r1963, r1966, r1975);
        return r1976;
}

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, \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 2020025 +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)))