Average Error: 0.1 → 0.1
Time: 11.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(z, 1 - \log t, \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(z, 1 - \log t, \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 r418233 = x;
        double r418234 = y;
        double r418235 = r418233 + r418234;
        double r418236 = z;
        double r418237 = r418235 + r418236;
        double r418238 = t;
        double r418239 = log(r418238);
        double r418240 = r418236 * r418239;
        double r418241 = r418237 - r418240;
        double r418242 = a;
        double r418243 = 0.5;
        double r418244 = r418242 - r418243;
        double r418245 = b;
        double r418246 = r418244 * r418245;
        double r418247 = r418241 + r418246;
        return r418247;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r418248 = z;
        double r418249 = 1.0;
        double r418250 = t;
        double r418251 = log(r418250);
        double r418252 = r418249 - r418251;
        double r418253 = a;
        double r418254 = 0.5;
        double r418255 = r418253 - r418254;
        double r418256 = b;
        double r418257 = x;
        double r418258 = y;
        double r418259 = r418257 + r418258;
        double r418260 = fma(r418255, r418256, r418259);
        double r418261 = fma(r418248, r418252, r418260);
        return r418261;
}

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(z, 1 - \log t, \mathsf{fma}\left(a - 0.5, b, x + y\right)\right)}\]
  3. Final simplification0.1

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

Reproduce

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