Average Error: 4.7 → 3.0
Time: 4.1s
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.86224786308500133 \cdot 10^{287}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - 1 \cdot \frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot \left(1 \cdot t\right)\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} \le 3.86224786308500133 \cdot 10^{287}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - 1 \cdot \frac{t}{1 - z}\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r432850 = x;
        double r432851 = y;
        double r432852 = z;
        double r432853 = r432851 / r432852;
        double r432854 = t;
        double r432855 = 1.0;
        double r432856 = r432855 - r432852;
        double r432857 = r432854 / r432856;
        double r432858 = r432853 - r432857;
        double r432859 = r432850 * r432858;
        return r432859;
}

double f(double x, double y, double z, double t) {
        double r432860 = y;
        double r432861 = z;
        double r432862 = r432860 / r432861;
        double r432863 = t;
        double r432864 = 1.0;
        double r432865 = r432864 - r432861;
        double r432866 = r432863 / r432865;
        double r432867 = r432862 - r432866;
        double r432868 = 3.862247863085001e+287;
        bool r432869 = r432867 <= r432868;
        double r432870 = x;
        double r432871 = 1.0;
        double r432872 = r432871 * r432866;
        double r432873 = r432862 - r432872;
        double r432874 = r432870 * r432873;
        double r432875 = r432860 * r432865;
        double r432876 = r432871 * r432863;
        double r432877 = r432861 * r432876;
        double r432878 = r432875 - r432877;
        double r432879 = r432870 * r432878;
        double r432880 = r432861 * r432865;
        double r432881 = r432879 / r432880;
        double r432882 = r432869 ? r432874 : r432881;
        return r432882;
}

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.7
Target4.2
Herbie3.0
\[\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.862247863085001e+287

    1. Initial program 3.1

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

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

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

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

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

    if 3.862247863085001e+287 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 47.1

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

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

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

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{1} \cdot \frac{t}{1 - z}\right)\]
    7. Using strategy rm
    8. Applied associate-*r/47.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le 3.86224786308500133 \cdot 10^{287}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - 1 \cdot \frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot \left(1 \cdot t\right)\right)}{z \cdot \left(1 - z\right)}\\ \end{array}\]

Reproduce

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