Average Error: 0.1 → 0.1
Time: 5.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(b, a - 0.5, z \cdot 1 + \mathsf{fma}\left(-\log t, z, 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, z \cdot 1 + \mathsf{fma}\left(-\log t, z, x + y\right)\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r314766 = x;
        double r314767 = y;
        double r314768 = r314766 + r314767;
        double r314769 = z;
        double r314770 = r314768 + r314769;
        double r314771 = t;
        double r314772 = log(r314771);
        double r314773 = r314769 * r314772;
        double r314774 = r314770 - r314773;
        double r314775 = a;
        double r314776 = 0.5;
        double r314777 = r314775 - r314776;
        double r314778 = b;
        double r314779 = r314777 * r314778;
        double r314780 = r314774 + r314779;
        return r314780;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r314781 = b;
        double r314782 = a;
        double r314783 = 0.5;
        double r314784 = r314782 - r314783;
        double r314785 = z;
        double r314786 = 1.0;
        double r314787 = r314785 * r314786;
        double r314788 = t;
        double r314789 = log(r314788);
        double r314790 = -r314789;
        double r314791 = x;
        double r314792 = y;
        double r314793 = r314791 + r314792;
        double r314794 = fma(r314790, r314785, r314793);
        double r314795 = r314787 + r314794;
        double r314796 = fma(r314781, r314784, r314795);
        return r314796;
}

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(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. Using strategy rm
  6. Applied fma-udef0.1

    \[\leadsto \mathsf{fma}\left(b, a - 0.5, \color{blue}{z \cdot \left(1 - \log t\right) + \left(x + y\right)}\right)\]
  7. Using strategy rm
  8. Applied sub-neg0.1

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

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

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

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

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

Reproduce

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