Average Error: 4.5 → 1.4
Time: 4.8s
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} \le -3.946683625255872 \cdot 10^{266} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 1.1311924329989099 \cdot 10^{302}\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} \le -3.946683625255872 \cdot 10^{266} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 1.1311924329989099 \cdot 10^{302}\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 r475651 = x;
        double r475652 = y;
        double r475653 = z;
        double r475654 = r475652 / r475653;
        double r475655 = t;
        double r475656 = 1.0;
        double r475657 = r475656 - r475653;
        double r475658 = r475655 / r475657;
        double r475659 = r475654 - r475658;
        double r475660 = r475651 * r475659;
        return r475660;
}

double f(double x, double y, double z, double t) {
        double r475661 = y;
        double r475662 = z;
        double r475663 = r475661 / r475662;
        double r475664 = t;
        double r475665 = 1.0;
        double r475666 = r475665 - r475662;
        double r475667 = r475664 / r475666;
        double r475668 = r475663 - r475667;
        double r475669 = -3.946683625255872e+266;
        bool r475670 = r475668 <= r475669;
        double r475671 = 1.1311924329989099e+302;
        bool r475672 = r475668 <= r475671;
        double r475673 = !r475672;
        bool r475674 = r475670 || r475673;
        double r475675 = x;
        double r475676 = r475661 * r475666;
        double r475677 = r475662 * r475664;
        double r475678 = r475676 - r475677;
        double r475679 = r475675 * r475678;
        double r475680 = r475662 * r475666;
        double r475681 = r475679 / r475680;
        double r475682 = r475675 * r475668;
        double r475683 = r475674 ? r475681 : r475682;
        return r475683;
}

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

Original4.5
Target4.1
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))) < -3.946683625255872e+266 or 1.1311924329989099e+302 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 43.3

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
    2. Using strategy rm
    3. Applied frac-sub44.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/1.7

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

    if -3.946683625255872e+266 < (- (/ y z) (/ t (- 1.0 z))) < 1.1311924329989099e+302

    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} \le -3.946683625255872 \cdot 10^{266} \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 1.1311924329989099 \cdot 10^{302}\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 2020065 
(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)))))