Average Error: 4.6 → 0.5
Time: 5.4s
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{\left(y \cdot \left(1 - z\right) - z \cdot t\right) \cdot x}{z \cdot \left(1 - z\right)}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -7.6803216666196787859258775622321955081 \cdot 10^{-192}:\\ \;\;\;\;\left(\frac{y}{z} - \frac{t}{1 - z}\right) \cdot x\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.29764750442091153963180672928801007007 \cdot 10^{-180}:\\ \;\;\;\;\frac{x \cdot y}{z} + \left(1 \cdot \frac{t \cdot x}{{z}^{2}} + \frac{t \cdot x}{z}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.408604342281935220885063637482282659219 \cdot 10^{283}:\\ \;\;\;\;\left(\frac{y}{z} - \frac{t}{1 - z}\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(y \cdot \left(1 - z\right) - z \cdot t\right) \cdot x}{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{\left(y \cdot \left(1 - z\right) - z \cdot t\right) \cdot x}{z \cdot \left(1 - z\right)}\\

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

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

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r557095 = x;
        double r557096 = y;
        double r557097 = z;
        double r557098 = r557096 / r557097;
        double r557099 = t;
        double r557100 = 1.0;
        double r557101 = r557100 - r557097;
        double r557102 = r557099 / r557101;
        double r557103 = r557098 - r557102;
        double r557104 = r557095 * r557103;
        return r557104;
}

double f(double x, double y, double z, double t) {
        double r557105 = y;
        double r557106 = z;
        double r557107 = r557105 / r557106;
        double r557108 = t;
        double r557109 = 1.0;
        double r557110 = r557109 - r557106;
        double r557111 = r557108 / r557110;
        double r557112 = r557107 - r557111;
        double r557113 = -inf.0;
        bool r557114 = r557112 <= r557113;
        double r557115 = r557105 * r557110;
        double r557116 = r557106 * r557108;
        double r557117 = r557115 - r557116;
        double r557118 = x;
        double r557119 = r557117 * r557118;
        double r557120 = r557106 * r557110;
        double r557121 = r557119 / r557120;
        double r557122 = -7.680321666619679e-192;
        bool r557123 = r557112 <= r557122;
        double r557124 = r557112 * r557118;
        double r557125 = 1.2976475044209115e-180;
        bool r557126 = r557112 <= r557125;
        double r557127 = r557118 * r557105;
        double r557128 = r557127 / r557106;
        double r557129 = r557108 * r557118;
        double r557130 = 2.0;
        double r557131 = pow(r557106, r557130);
        double r557132 = r557129 / r557131;
        double r557133 = r557109 * r557132;
        double r557134 = r557129 / r557106;
        double r557135 = r557133 + r557134;
        double r557136 = r557128 + r557135;
        double r557137 = 1.4086043422819352e+283;
        bool r557138 = r557112 <= r557137;
        double r557139 = r557138 ? r557124 : r557121;
        double r557140 = r557126 ? r557136 : r557139;
        double r557141 = r557123 ? r557124 : r557140;
        double r557142 = r557114 ? r557121 : r557141;
        return r557142;
}

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.6
Target4.4
Herbie0.5
\[\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.4086043422819352e+283 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 53.9

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

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

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

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

    if -inf.0 < (- (/ y z) (/ t (- 1.0 z))) < -7.680321666619679e-192 or 1.2976475044209115e-180 < (- (/ y z) (/ t (- 1.0 z))) < 1.4086043422819352e+283

    1. Initial program 0.2

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

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

    if -7.680321666619679e-192 < (- (/ y z) (/ t (- 1.0 z))) < 1.2976475044209115e-180

    1. Initial program 6.5

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

      \[\leadsto \color{blue}{\left(\frac{y}{z} - \frac{t}{1 - z}\right) \cdot x}\]
    4. Taylor expanded around inf 1.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} = -\infty:\\ \;\;\;\;\frac{\left(y \cdot \left(1 - z\right) - z \cdot t\right) \cdot x}{z \cdot \left(1 - z\right)}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -7.6803216666196787859258775622321955081 \cdot 10^{-192}:\\ \;\;\;\;\left(\frac{y}{z} - \frac{t}{1 - z}\right) \cdot x\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.29764750442091153963180672928801007007 \cdot 10^{-180}:\\ \;\;\;\;\frac{x \cdot y}{z} + \left(1 \cdot \frac{t \cdot x}{{z}^{2}} + \frac{t \cdot x}{z}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.408604342281935220885063637482282659219 \cdot 10^{283}:\\ \;\;\;\;\left(\frac{y}{z} - \frac{t}{1 - z}\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(y \cdot \left(1 - z\right) - z \cdot t\right) \cdot x}{z \cdot \left(1 - z\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2019362 
(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)))))