Average Error: 0.1 → 0.1
Time: 24.9s
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, y\right) + \mathsf{fma}\left(z, 1 - \log t, 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, y\right) + \mathsf{fma}\left(z, 1 - \log t, x\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r18240112 = x;
        double r18240113 = y;
        double r18240114 = r18240112 + r18240113;
        double r18240115 = z;
        double r18240116 = r18240114 + r18240115;
        double r18240117 = t;
        double r18240118 = log(r18240117);
        double r18240119 = r18240115 * r18240118;
        double r18240120 = r18240116 - r18240119;
        double r18240121 = a;
        double r18240122 = 0.5;
        double r18240123 = r18240121 - r18240122;
        double r18240124 = b;
        double r18240125 = r18240123 * r18240124;
        double r18240126 = r18240120 + r18240125;
        return r18240126;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r18240127 = b;
        double r18240128 = a;
        double r18240129 = 0.5;
        double r18240130 = r18240128 - r18240129;
        double r18240131 = y;
        double r18240132 = fma(r18240127, r18240130, r18240131);
        double r18240133 = z;
        double r18240134 = 1.0;
        double r18240135 = t;
        double r18240136 = log(r18240135);
        double r18240137 = r18240134 - r18240136;
        double r18240138 = x;
        double r18240139 = fma(r18240133, r18240137, r18240138);
        double r18240140 = r18240132 + r18240139;
        return r18240140;
}

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

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

Reproduce

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