Average Error: 4.6 → 1.0
Time: 5.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} \le -3.35543000838061064 \cdot 10^{235}:\\ \;\;\;\;\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 -4.97794589728648552 \cdot 10^{-125}:\\ \;\;\;\;x \cdot \left(1 \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.30382 \cdot 10^{-318}:\\ \;\;\;\;\frac{x}{z} \cdot \left(t + y\right) + 1 \cdot \frac{t \cdot x}{{z}^{2}}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.41799867298773897 \cdot 10^{307}:\\ \;\;\;\;x \cdot \left(1 \cdot \left(\frac{y}{z} - \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} \le -3.35543000838061064 \cdot 10^{235}:\\
\;\;\;\;\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 -4.97794589728648552 \cdot 10^{-125}:\\
\;\;\;\;x \cdot \left(1 \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\right)\\

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

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.41799867298773897 \cdot 10^{307}:\\
\;\;\;\;x \cdot \left(1 \cdot \left(\frac{y}{z} - \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 r364921 = x;
        double r364922 = y;
        double r364923 = z;
        double r364924 = r364922 / r364923;
        double r364925 = t;
        double r364926 = 1.0;
        double r364927 = r364926 - r364923;
        double r364928 = r364925 / r364927;
        double r364929 = r364924 - r364928;
        double r364930 = r364921 * r364929;
        return r364930;
}

double f(double x, double y, double z, double t) {
        double r364931 = y;
        double r364932 = z;
        double r364933 = r364931 / r364932;
        double r364934 = t;
        double r364935 = 1.0;
        double r364936 = r364935 - r364932;
        double r364937 = r364934 / r364936;
        double r364938 = r364933 - r364937;
        double r364939 = -3.3554300083806106e+235;
        bool r364940 = r364938 <= r364939;
        double r364941 = x;
        double r364942 = r364931 * r364936;
        double r364943 = r364932 * r364934;
        double r364944 = r364942 - r364943;
        double r364945 = r364941 * r364944;
        double r364946 = r364932 * r364936;
        double r364947 = r364945 / r364946;
        double r364948 = -4.977945897286486e-125;
        bool r364949 = r364938 <= r364948;
        double r364950 = 1.0;
        double r364951 = r364950 * r364938;
        double r364952 = r364941 * r364951;
        double r364953 = 1.3038194767492e-318;
        bool r364954 = r364938 <= r364953;
        double r364955 = r364941 / r364932;
        double r364956 = r364934 + r364931;
        double r364957 = r364955 * r364956;
        double r364958 = r364934 * r364941;
        double r364959 = 2.0;
        double r364960 = pow(r364932, r364959);
        double r364961 = r364958 / r364960;
        double r364962 = r364935 * r364961;
        double r364963 = r364957 + r364962;
        double r364964 = 1.417998672987739e+307;
        bool r364965 = r364938 <= r364964;
        double r364966 = r364965 ? r364952 : r364947;
        double r364967 = r364954 ? r364963 : r364966;
        double r364968 = r364949 ? r364952 : r364967;
        double r364969 = r364940 ? r364947 : r364968;
        return r364969;
}

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.6
Herbie1.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 3 regimes
  2. if (- (/ y z) (/ t (- 1.0 z))) < -3.3554300083806106e+235 or 1.417998672987739e+307 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 38.0

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

      \[\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.9

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

    if -3.3554300083806106e+235 < (- (/ y z) (/ t (- 1.0 z))) < -4.977945897286486e-125 or 1.3038194767492e-318 < (- (/ y z) (/ t (- 1.0 z))) < 1.417998672987739e+307

    1. Initial program 0.2

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

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

    if -4.977945897286486e-125 < (- (/ y z) (/ t (- 1.0 z))) < 1.3038194767492e-318

    1. Initial program 7.6

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le -3.35543000838061064 \cdot 10^{235}:\\ \;\;\;\;\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 -4.97794589728648552 \cdot 10^{-125}:\\ \;\;\;\;x \cdot \left(1 \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.30382 \cdot 10^{-318}:\\ \;\;\;\;\frac{x}{z} \cdot \left(t + y\right) + 1 \cdot \frac{t \cdot x}{{z}^{2}}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.41799867298773897 \cdot 10^{307}:\\ \;\;\;\;x \cdot \left(1 \cdot \left(\frac{y}{z} - \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 2020024 
(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)))))