Average Error: 0.1 → 0.1
Time: 21.7s
Precision: 64
\[\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b\]
\[\left(z - \log t \cdot z\right) + \mathsf{fma}\left(a - 0.5, b, x + y\right)\]
\left(\left(\left(x + y\right) + z\right) - z \cdot \log t\right) + \left(a - 0.5\right) \cdot b
\left(z - \log t \cdot z\right) + \mathsf{fma}\left(a - 0.5, b, x + y\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r481160 = x;
        double r481161 = y;
        double r481162 = r481160 + r481161;
        double r481163 = z;
        double r481164 = r481162 + r481163;
        double r481165 = t;
        double r481166 = log(r481165);
        double r481167 = r481163 * r481166;
        double r481168 = r481164 - r481167;
        double r481169 = a;
        double r481170 = 0.5;
        double r481171 = r481169 - r481170;
        double r481172 = b;
        double r481173 = r481171 * r481172;
        double r481174 = r481168 + r481173;
        return r481174;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r481175 = z;
        double r481176 = t;
        double r481177 = log(r481176);
        double r481178 = r481177 * r481175;
        double r481179 = r481175 - r481178;
        double r481180 = a;
        double r481181 = 0.5;
        double r481182 = r481180 - r481181;
        double r481183 = b;
        double r481184 = x;
        double r481185 = y;
        double r481186 = r481184 + r481185;
        double r481187 = fma(r481182, r481183, r481186);
        double r481188 = r481179 + r481187;
        return r481188;
}

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, \mathsf{fma}\left(a - 0.5, b, x + y\right)\right)}\]
  3. Using strategy rm
  4. Applied fma-udef0.1

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

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

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

Reproduce

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