Average Error: 4.8 → 1.3
Time: 17.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 5.904265829548936645690003942262148511215 \cdot 10^{295}\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 5.904265829548936645690003942262148511215 \cdot 10^{295}\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 r296034 = x;
        double r296035 = y;
        double r296036 = z;
        double r296037 = r296035 / r296036;
        double r296038 = t;
        double r296039 = 1.0;
        double r296040 = r296039 - r296036;
        double r296041 = r296038 / r296040;
        double r296042 = r296037 - r296041;
        double r296043 = r296034 * r296042;
        return r296043;
}

double f(double x, double y, double z, double t) {
        double r296044 = y;
        double r296045 = z;
        double r296046 = r296044 / r296045;
        double r296047 = t;
        double r296048 = 1.0;
        double r296049 = r296048 - r296045;
        double r296050 = r296047 / r296049;
        double r296051 = r296046 - r296050;
        double r296052 = -inf.0;
        bool r296053 = r296051 <= r296052;
        double r296054 = 5.904265829548937e+295;
        bool r296055 = r296051 <= r296054;
        double r296056 = !r296055;
        bool r296057 = r296053 || r296056;
        double r296058 = x;
        double r296059 = r296044 * r296049;
        double r296060 = r296045 * r296047;
        double r296061 = r296059 - r296060;
        double r296062 = r296058 * r296061;
        double r296063 = r296045 * r296049;
        double r296064 = r296062 / r296063;
        double r296065 = r296058 * r296051;
        double r296066 = r296057 ? r296064 : r296065;
        return r296066;
}

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.8
Target4.5
Herbie1.3
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \lt -7.623226303312042442144691872793570510727 \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.413394492770230216018398633584271456447 \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 5.904265829548937e+295 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 57.9

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

      \[\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.2

      \[\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))) < 5.904265829548937e+295

    1. Initial program 1.3

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

    \[\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 5.904265829548936645690003942262148511215 \cdot 10^{295}\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 2019325 
(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)))))