Average Error: 5.0 → 1.4
Time: 6.5s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} = -\infty \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 8.9138883838275488 \cdot 10^{292}\right):\\ \;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} = -\infty \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 8.9138883838275488 \cdot 10^{292}\right):\\
\;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r271814 = x;
        double r271815 = y;
        double r271816 = z;
        double r271817 = r271815 / r271816;
        double r271818 = t;
        double r271819 = 1.0;
        double r271820 = r271819 - r271816;
        double r271821 = r271818 / r271820;
        double r271822 = r271817 - r271821;
        double r271823 = r271814 * r271822;
        return r271823;
}

double f(double x, double y, double z, double t) {
        double r271824 = y;
        double r271825 = z;
        double r271826 = r271824 / r271825;
        double r271827 = t;
        double r271828 = 1.0;
        double r271829 = r271828 - r271825;
        double r271830 = r271827 / r271829;
        double r271831 = r271826 - r271830;
        double r271832 = -inf.0;
        bool r271833 = r271831 <= r271832;
        double r271834 = 8.913888383827549e+292;
        bool r271835 = r271831 <= r271834;
        double r271836 = !r271835;
        bool r271837 = r271833 || r271836;
        double r271838 = x;
        double r271839 = r271824 * r271829;
        double r271840 = r271825 * r271827;
        double r271841 = r271839 - r271840;
        double r271842 = r271838 * r271841;
        double r271843 = r271825 * r271829;
        double r271844 = r271842 / r271843;
        double r271845 = r271838 * r271831;
        double r271846 = r271837 ? r271844 : r271845;
        return r271846;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.0
Target4.5
Herbie1.4
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \lt -7.62322630331204244 \cdot 10^{-196}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\ \mathbf{elif}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \lt 1.41339449277023022 \cdot 10^{-211}:\\ \;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (- (/ y z) (/ t (- 1.0 z))) < -inf.0 or 8.913888383827549e+292 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 56.7

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
    2. Using strategy rm
    3. Applied frac-sub56.7

      \[\leadsto x \cdot \color{blue}{\frac{y \cdot \left(1 - z\right) - z \cdot t}{z \cdot \left(1 - z\right)}}\]
    4. Applied associate-*r/0.3

      \[\leadsto \color{blue}{\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}}\]

    if -inf.0 < (- (/ y z) (/ t (- 1.0 z))) < 8.913888383827549e+292

    1. Initial program 1.4

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} = -\infty \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 8.9138883838275488 \cdot 10^{292}\right):\\ \;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020003 
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
  :precision binary64

  :herbie-target
  (if (< (* x (- (/ y z) (/ t (- 1 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z)))))))

  (* x (- (/ y z) (/ t (- 1 z)))))