Average Error: 4.5 → 0.3
Time: 16.7s
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:\\ \;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -9.623384634099063773841689265161232605253 \cdot 10^{-218}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} + \left(-\frac{t}{1 - z}\right)\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -0.0:\\ \;\;\;\;\left(\frac{1}{z} + 1\right) \cdot \frac{t \cdot x}{z} + \frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.21078697094796720908500090745083338753 \cdot 10^{283}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} + \left(-\frac{t}{1 - z}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(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:\\
\;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -9.623384634099063773841689265161232605253 \cdot 10^{-218}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} + \left(-\frac{t}{1 - z}\right)\right)\\

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -0.0:\\
\;\;\;\;\left(\frac{1}{z} + 1\right) \cdot \frac{t \cdot x}{z} + \frac{x \cdot y}{z}\\

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.21078697094796720908500090745083338753 \cdot 10^{283}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} + \left(-\frac{t}{1 - z}\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r267072 = x;
        double r267073 = y;
        double r267074 = z;
        double r267075 = r267073 / r267074;
        double r267076 = t;
        double r267077 = 1.0;
        double r267078 = r267077 - r267074;
        double r267079 = r267076 / r267078;
        double r267080 = r267075 - r267079;
        double r267081 = r267072 * r267080;
        return r267081;
}

double f(double x, double y, double z, double t) {
        double r267082 = y;
        double r267083 = z;
        double r267084 = r267082 / r267083;
        double r267085 = t;
        double r267086 = 1.0;
        double r267087 = r267086 - r267083;
        double r267088 = r267085 / r267087;
        double r267089 = r267084 - r267088;
        double r267090 = -inf.0;
        bool r267091 = r267089 <= r267090;
        double r267092 = x;
        double r267093 = r267082 * r267087;
        double r267094 = r267083 * r267085;
        double r267095 = r267093 - r267094;
        double r267096 = r267092 * r267095;
        double r267097 = r267083 * r267087;
        double r267098 = r267096 / r267097;
        double r267099 = -9.623384634099064e-218;
        bool r267100 = r267089 <= r267099;
        double r267101 = -r267088;
        double r267102 = r267084 + r267101;
        double r267103 = r267092 * r267102;
        double r267104 = -0.0;
        bool r267105 = r267089 <= r267104;
        double r267106 = r267086 / r267083;
        double r267107 = 1.0;
        double r267108 = r267106 + r267107;
        double r267109 = r267085 * r267092;
        double r267110 = r267109 / r267083;
        double r267111 = r267108 * r267110;
        double r267112 = r267092 * r267082;
        double r267113 = r267112 / r267083;
        double r267114 = r267111 + r267113;
        double r267115 = 1.2107869709479672e+283;
        bool r267116 = r267089 <= r267115;
        double r267117 = r267116 ? r267103 : r267098;
        double r267118 = r267105 ? r267114 : r267117;
        double r267119 = r267100 ? r267103 : r267118;
        double r267120 = r267091 ? r267098 : r267119;
        return r267120;
}

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.2
Herbie0.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 3 regimes
  2. if (- (/ y z) (/ t (- 1.0 z))) < -inf.0 or 1.2107869709479672e+283 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 52.7

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

      \[\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))) < -9.623384634099064e-218 or -0.0 < (- (/ y z) (/ t (- 1.0 z))) < 1.2107869709479672e+283

    1. Initial program 1.1

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{t \cdot \frac{1}{1 - z}}\right)\]
    4. Using strategy rm
    5. Applied sub-neg1.1

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

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

    if -9.623384634099064e-218 < (- (/ y z) (/ t (- 1.0 z))) < -0.0

    1. Initial program 4.9

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
    2. Taylor expanded around inf 1.3

      \[\leadsto \color{blue}{\frac{x \cdot y}{z} + \left(1 \cdot \frac{t \cdot x}{{z}^{2}} + \frac{t \cdot x}{z}\right)}\]
    3. Simplified1.3

      \[\leadsto \color{blue}{\left(\frac{1}{z} + 1\right) \cdot \frac{t \cdot x}{z} + \frac{x \cdot y}{z}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} = -\infty:\\ \;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -9.623384634099063773841689265161232605253 \cdot 10^{-218}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} + \left(-\frac{t}{1 - z}\right)\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -0.0:\\ \;\;\;\;\left(\frac{1}{z} + 1\right) \cdot \frac{t \cdot x}{z} + \frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.21078697094796720908500090745083338753 \cdot 10^{283}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} + \left(-\frac{t}{1 - z}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2019303 
(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.62322630331204244e-196) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 1.41339449277023022e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z)))))))

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