Average Error: 4.5 → 0.5
Time: 5.3s
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 -1.1452666004728999 \cdot 10^{-225}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{1}{\frac{1 - z}{t}}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 0.0:\\ \;\;\;\;\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 4.89632243254389172 \cdot 10^{235}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{1}{\frac{1 - z}{t}}\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 -1.1452666004728999 \cdot 10^{-225}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \frac{1}{\frac{1 - z}{t}}\right)\\

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 0.0:\\
\;\;\;\;\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 4.89632243254389172 \cdot 10^{235}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \frac{1}{\frac{1 - z}{t}}\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 r415026 = x;
        double r415027 = y;
        double r415028 = z;
        double r415029 = r415027 / r415028;
        double r415030 = t;
        double r415031 = 1.0;
        double r415032 = r415031 - r415028;
        double r415033 = r415030 / r415032;
        double r415034 = r415029 - r415033;
        double r415035 = r415026 * r415034;
        return r415035;
}

double f(double x, double y, double z, double t) {
        double r415036 = y;
        double r415037 = z;
        double r415038 = r415036 / r415037;
        double r415039 = t;
        double r415040 = 1.0;
        double r415041 = r415040 - r415037;
        double r415042 = r415039 / r415041;
        double r415043 = r415038 - r415042;
        double r415044 = -inf.0;
        bool r415045 = r415043 <= r415044;
        double r415046 = x;
        double r415047 = r415036 * r415041;
        double r415048 = r415037 * r415039;
        double r415049 = r415047 - r415048;
        double r415050 = r415046 * r415049;
        double r415051 = r415037 * r415041;
        double r415052 = r415050 / r415051;
        double r415053 = -1.1452666004728999e-225;
        bool r415054 = r415043 <= r415053;
        double r415055 = 1.0;
        double r415056 = r415041 / r415039;
        double r415057 = r415055 / r415056;
        double r415058 = r415038 - r415057;
        double r415059 = r415046 * r415058;
        double r415060 = 0.0;
        bool r415061 = r415043 <= r415060;
        double r415062 = r415046 * r415036;
        double r415063 = r415062 / r415037;
        double r415064 = r415039 * r415046;
        double r415065 = 2.0;
        double r415066 = pow(r415037, r415065);
        double r415067 = r415064 / r415066;
        double r415068 = r415040 * r415067;
        double r415069 = r415064 / r415037;
        double r415070 = r415068 + r415069;
        double r415071 = r415063 + r415070;
        double r415072 = 4.8963224325438917e+235;
        bool r415073 = r415043 <= r415072;
        double r415074 = r415073 ? r415059 : r415052;
        double r415075 = r415061 ? r415071 : r415074;
        double r415076 = r415054 ? r415059 : r415075;
        double r415077 = r415045 ? r415052 : r415076;
        return r415077;
}

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.0
Herbie0.5
\[\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 3 regimes
  2. if (- (/ y z) (/ t (- 1.0 z))) < -inf.0 or 4.8963224325438917e+235 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 35.4

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

      \[\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/2.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))) < -1.1452666004728999e-225 or 0.0 < (- (/ y z) (/ t (- 1.0 z))) < 4.8963224325438917e+235

    1. Initial program 0.3

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

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

    if -1.1452666004728999e-225 < (- (/ y z) (/ t (- 1.0 z))) < 0.0

    1. Initial program 14.0

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

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

      \[\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{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 -1.1452666004728999 \cdot 10^{-225}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{1}{\frac{1 - z}{t}}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 0.0:\\ \;\;\;\;\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 4.89632243254389172 \cdot 10^{235}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{1}{\frac{1 - z}{t}}\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 2020018 
(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)))))