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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r363052 = x;
        double r363053 = y;
        double r363054 = z;
        double r363055 = r363053 / r363054;
        double r363056 = t;
        double r363057 = 1.0;
        double r363058 = r363057 - r363054;
        double r363059 = r363056 / r363058;
        double r363060 = r363055 - r363059;
        double r363061 = r363052 * r363060;
        return r363061;
}

double f(double x, double y, double z, double t) {
        double r363062 = x;
        double r363063 = y;
        double r363064 = z;
        double r363065 = r363063 / r363064;
        double r363066 = t;
        double r363067 = 1.0;
        double r363068 = r363067 - r363064;
        double r363069 = r363066 / r363068;
        double r363070 = r363065 - r363069;
        double r363071 = r363062 * r363070;
        double r363072 = -inf.0;
        bool r363073 = r363071 <= r363072;
        double r363074 = 1.9283964919862685e+299;
        bool r363075 = r363071 <= r363074;
        double r363076 = !r363075;
        bool r363077 = r363073 || r363076;
        double r363078 = r363063 * r363068;
        double r363079 = r363064 * r363066;
        double r363080 = r363078 - r363079;
        double r363081 = r363062 * r363080;
        double r363082 = 1.0;
        double r363083 = r363064 * r363068;
        double r363084 = r363082 * r363083;
        double r363085 = r363081 / r363084;
        double r363086 = r363082 * r363070;
        double r363087 = r363062 * r363086;
        double r363088 = r363077 ? r363085 : r363087;
        return r363088;
}

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.4
Herbie1.3
\[\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 (* x (- (/ y z) (/ t (- 1.0 z)))) < -inf.0 or 1.9283964919862685e+299 < (* x (- (/ y z) (/ t (- 1.0 z))))

    1. Initial program 58.9

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \frac{t}{\color{blue}{1 \cdot \left(1 - z\right)}}\right)\]
    4. Applied *-un-lft-identity58.9

      \[\leadsto x \cdot \left(\frac{y}{z} - \frac{\color{blue}{1 \cdot t}}{1 \cdot \left(1 - z\right)}\right)\]
    5. Applied times-frac58.9

      \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\frac{1}{1} \cdot \frac{t}{1 - z}}\right)\]
    6. Applied *-un-lft-identity58.9

      \[\leadsto x \cdot \left(\frac{y}{\color{blue}{1 \cdot z}} - \frac{1}{1} \cdot \frac{t}{1 - z}\right)\]
    7. Applied *-un-lft-identity58.9

      \[\leadsto x \cdot \left(\frac{\color{blue}{1 \cdot y}}{1 \cdot z} - \frac{1}{1} \cdot \frac{t}{1 - z}\right)\]
    8. Applied times-frac58.9

      \[\leadsto x \cdot \left(\color{blue}{\frac{1}{1} \cdot \frac{y}{z}} - \frac{1}{1} \cdot \frac{t}{1 - z}\right)\]
    9. Applied distribute-lft-out--58.9

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

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

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

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

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

    if -inf.0 < (* x (- (/ y z) (/ t (- 1.0 z)))) < 1.9283964919862685e+299

    1. Initial program 1.3

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \frac{t}{\color{blue}{1 \cdot \left(1 - z\right)}}\right)\]
    4. Applied *-un-lft-identity1.3

      \[\leadsto x \cdot \left(\frac{y}{z} - \frac{\color{blue}{1 \cdot t}}{1 \cdot \left(1 - z\right)}\right)\]
    5. Applied times-frac1.3

      \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\frac{1}{1} \cdot \frac{t}{1 - z}}\right)\]
    6. Applied *-un-lft-identity1.3

      \[\leadsto x \cdot \left(\frac{y}{\color{blue}{1 \cdot z}} - \frac{1}{1} \cdot \frac{t}{1 - z}\right)\]
    7. Applied *-un-lft-identity1.3

      \[\leadsto x \cdot \left(\frac{\color{blue}{1 \cdot y}}{1 \cdot z} - \frac{1}{1} \cdot \frac{t}{1 - z}\right)\]
    8. Applied times-frac1.3

      \[\leadsto x \cdot \left(\color{blue}{\frac{1}{1} \cdot \frac{y}{z}} - \frac{1}{1} \cdot \frac{t}{1 - z}\right)\]
    9. Applied distribute-lft-out--1.3

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

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

Reproduce

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