Average Error: 4.9 → 2.9
Time: 47.0s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1.0 - z} = -\infty:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1.0 - z} \le 3.6934964504565474 \cdot 10^{+254}:\\ \;\;\;\;\sqrt[3]{\frac{y}{z} - \frac{t}{1.0 - z}} \cdot \left(\left(\sqrt[3]{\frac{y}{z} - \frac{t}{1.0 - z}} \cdot \sqrt[3]{\frac{y}{z} - \frac{t}{1.0 - z}}\right) \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} - \frac{t}{1.0 - z} = -\infty:\\
\;\;\;\;\frac{y \cdot x}{z}\\

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1.0 - z} \le 3.6934964504565474 \cdot 10^{+254}:\\
\;\;\;\;\sqrt[3]{\frac{y}{z} - \frac{t}{1.0 - z}} \cdot \left(\left(\sqrt[3]{\frac{y}{z} - \frac{t}{1.0 - z}} \cdot \sqrt[3]{\frac{y}{z} - \frac{t}{1.0 - z}}\right) \cdot x\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r23353873 = x;
        double r23353874 = y;
        double r23353875 = z;
        double r23353876 = r23353874 / r23353875;
        double r23353877 = t;
        double r23353878 = 1.0;
        double r23353879 = r23353878 - r23353875;
        double r23353880 = r23353877 / r23353879;
        double r23353881 = r23353876 - r23353880;
        double r23353882 = r23353873 * r23353881;
        return r23353882;
}

double f(double x, double y, double z, double t) {
        double r23353883 = y;
        double r23353884 = z;
        double r23353885 = r23353883 / r23353884;
        double r23353886 = t;
        double r23353887 = 1.0;
        double r23353888 = r23353887 - r23353884;
        double r23353889 = r23353886 / r23353888;
        double r23353890 = r23353885 - r23353889;
        double r23353891 = -inf.0;
        bool r23353892 = r23353890 <= r23353891;
        double r23353893 = x;
        double r23353894 = r23353883 * r23353893;
        double r23353895 = r23353894 / r23353884;
        double r23353896 = 3.6934964504565474e+254;
        bool r23353897 = r23353890 <= r23353896;
        double r23353898 = cbrt(r23353890);
        double r23353899 = r23353898 * r23353898;
        double r23353900 = r23353899 * r23353893;
        double r23353901 = r23353898 * r23353900;
        double r23353902 = r23353897 ? r23353901 : r23353895;
        double r23353903 = r23353892 ? r23353895 : r23353902;
        return r23353903;
}

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.9
Target4.5
Herbie2.9
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right) \lt -7.623226303312042 \cdot 10^{-196}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1.0}{1.0 - z}\right)\\ \mathbf{elif}\;x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right) \lt 1.4133944927702302 \cdot 10^{-211}:\\ \;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1.0 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1.0}{1.0 - z}\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (- (/ y z) (/ t (- 1.0 z))) < -inf.0 or 3.6934964504565474e+254 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 42.7

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)\]
    2. Taylor expanded around 0 8.6

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]

    if -inf.0 < (- (/ y z) (/ t (- 1.0 z))) < 3.6934964504565474e+254

    1. Initial program 1.4

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)\]
    2. Using strategy rm
    3. Applied add-cube-cbrt2.4

      \[\leadsto x \cdot \color{blue}{\left(\left(\sqrt[3]{\frac{y}{z} - \frac{t}{1.0 - z}} \cdot \sqrt[3]{\frac{y}{z} - \frac{t}{1.0 - z}}\right) \cdot \sqrt[3]{\frac{y}{z} - \frac{t}{1.0 - z}}\right)}\]
    4. Applied associate-*r*2.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1.0 - z} = -\infty:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1.0 - z} \le 3.6934964504565474 \cdot 10^{+254}:\\ \;\;\;\;\sqrt[3]{\frac{y}{z} - \frac{t}{1.0 - z}} \cdot \left(\left(\sqrt[3]{\frac{y}{z} - \frac{t}{1.0 - z}} \cdot \sqrt[3]{\frac{y}{z} - \frac{t}{1.0 - z}}\right) \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019165 
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"

  :herbie-target
  (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))

  (* x (- (/ y z) (/ t (- 1.0 z)))))