Average Error: 1.8 → 1.3
Time: 50.6s
Precision: 64
\[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\]
\[\frac{\frac{{a}^{\left(-1\right)}}{e^{\mathsf{fma}\left(y, -\log z, \mathsf{fma}\left(-\log a, t, b\right)\right)}}}{y} \cdot x\]
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\frac{\frac{{a}^{\left(-1\right)}}{e^{\mathsf{fma}\left(y, -\log z, \mathsf{fma}\left(-\log a, t, b\right)\right)}}}{y} \cdot x
double f(double x, double y, double z, double t, double a, double b) {
        double r313805 = x;
        double r313806 = y;
        double r313807 = z;
        double r313808 = log(r313807);
        double r313809 = r313806 * r313808;
        double r313810 = t;
        double r313811 = 1.0;
        double r313812 = r313810 - r313811;
        double r313813 = a;
        double r313814 = log(r313813);
        double r313815 = r313812 * r313814;
        double r313816 = r313809 + r313815;
        double r313817 = b;
        double r313818 = r313816 - r313817;
        double r313819 = exp(r313818);
        double r313820 = r313805 * r313819;
        double r313821 = r313820 / r313806;
        return r313821;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r313822 = a;
        double r313823 = 1.0;
        double r313824 = -r313823;
        double r313825 = pow(r313822, r313824);
        double r313826 = y;
        double r313827 = z;
        double r313828 = log(r313827);
        double r313829 = -r313828;
        double r313830 = log(r313822);
        double r313831 = -r313830;
        double r313832 = t;
        double r313833 = b;
        double r313834 = fma(r313831, r313832, r313833);
        double r313835 = fma(r313826, r313829, r313834);
        double r313836 = exp(r313835);
        double r313837 = r313825 / r313836;
        double r313838 = r313837 / r313826;
        double r313839 = x;
        double r313840 = r313838 * r313839;
        return r313840;
}

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

Original1.8
Target11.0
Herbie1.3
\[\begin{array}{l} \mathbf{if}\;t \lt -0.88458485041274715:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \mathbf{elif}\;t \lt 852031.22883740731:\\ \;\;\;\;\frac{\frac{x}{y} \cdot {a}^{\left(t - 1\right)}}{e^{b - \log z \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{{a}^{\left(t - 1\right)}}{y}}{\left(b + 1\right) - y \cdot \log z}\\ \end{array}\]

Derivation

  1. Initial program 1.8

    \[\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\]
  2. Taylor expanded around inf 1.8

    \[\leadsto \color{blue}{\frac{x \cdot e^{1 \cdot \log \left(\frac{1}{a}\right) - \left(y \cdot \log \left(\frac{1}{z}\right) + \left(\log \left(\frac{1}{a}\right) \cdot t + b\right)\right)}}{y}}\]
  3. Simplified5.9

    \[\leadsto \color{blue}{\frac{\frac{{a}^{\left(-1\right)}}{e^{\mathsf{fma}\left(y, -\log z, \mathsf{fma}\left(-\log a, t, b\right)\right)}}}{\frac{y}{x}}}\]
  4. Using strategy rm
  5. Applied associate-/r/1.3

    \[\leadsto \color{blue}{\frac{\frac{{a}^{\left(-1\right)}}{e^{\mathsf{fma}\left(y, -\log z, \mathsf{fma}\left(-\log a, t, b\right)\right)}}}{y} \cdot x}\]
  6. Final simplification1.3

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

Reproduce

herbie shell --seed 2019199 +o rules:numerics
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A"

  :herbie-target
  (if (< t -0.8845848504127471) (/ (* x (/ (pow a (- t 1.0)) y)) (- (+ b 1.0) (* y (log z)))) (if (< t 852031.2288374073) (/ (* (/ x y) (pow a (- t 1.0))) (exp (- b (* (log z) y)))) (/ (* x (/ (pow a (- t 1.0)) y)) (- (+ b 1.0) (* y (log z))))))

  (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))