Average Error: 0.1 → 0.1
Time: 16.6s
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 r461230 = x;
        double r461231 = y;
        double r461232 = r461230 + r461231;
        double r461233 = z;
        double r461234 = r461232 + r461233;
        double r461235 = t;
        double r461236 = log(r461235);
        double r461237 = r461233 * r461236;
        double r461238 = r461234 - r461237;
        double r461239 = a;
        double r461240 = 0.5;
        double r461241 = r461239 - r461240;
        double r461242 = b;
        double r461243 = r461241 * r461242;
        double r461244 = r461238 + r461243;
        return r461244;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r461245 = z;
        double r461246 = 1.0;
        double r461247 = t;
        double r461248 = log(r461247);
        double r461249 = r461246 - r461248;
        double r461250 = a;
        double r461251 = 0.5;
        double r461252 = r461250 - r461251;
        double r461253 = b;
        double r461254 = x;
        double r461255 = y;
        double r461256 = r461254 + r461255;
        double r461257 = fma(r461252, r461253, r461256);
        double r461258 = fma(r461245, r461249, r461257);
        return r461258;
}

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)))