Average Error: 4.4 → 4.1
Time: 6.2s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.09852178693390844 \cdot 10^{-16}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} + \left(-\frac{t}{1 - z} \cdot 1\right)\right) + x \cdot \left(\frac{t}{1 - z} \cdot \left(\left(-1\right) + 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x \cdot y\right) \cdot \frac{1}{z} + \left(-x \cdot \frac{t}{1 - z}\right)\right) + x \cdot \left(\frac{t}{1 - z} \cdot \left(\left(-1\right) + 1\right)\right)\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
\mathbf{if}\;x \le -4.09852178693390844 \cdot 10^{-16}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} + \left(-\frac{t}{1 - z} \cdot 1\right)\right) + x \cdot \left(\frac{t}{1 - z} \cdot \left(\left(-1\right) + 1\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r490743 = x;
        double r490744 = y;
        double r490745 = z;
        double r490746 = r490744 / r490745;
        double r490747 = t;
        double r490748 = 1.0;
        double r490749 = r490748 - r490745;
        double r490750 = r490747 / r490749;
        double r490751 = r490746 - r490750;
        double r490752 = r490743 * r490751;
        return r490752;
}

double f(double x, double y, double z, double t) {
        double r490753 = x;
        double r490754 = -4.0985217869339084e-16;
        bool r490755 = r490753 <= r490754;
        double r490756 = y;
        double r490757 = z;
        double r490758 = r490756 / r490757;
        double r490759 = t;
        double r490760 = 1.0;
        double r490761 = r490760 - r490757;
        double r490762 = r490759 / r490761;
        double r490763 = 1.0;
        double r490764 = r490762 * r490763;
        double r490765 = -r490764;
        double r490766 = r490758 + r490765;
        double r490767 = r490753 * r490766;
        double r490768 = -r490763;
        double r490769 = r490768 + r490763;
        double r490770 = r490762 * r490769;
        double r490771 = r490753 * r490770;
        double r490772 = r490767 + r490771;
        double r490773 = r490753 * r490756;
        double r490774 = r490763 / r490757;
        double r490775 = r490773 * r490774;
        double r490776 = r490753 * r490762;
        double r490777 = -r490776;
        double r490778 = r490775 + r490777;
        double r490779 = r490778 + r490771;
        double r490780 = r490755 ? r490772 : r490779;
        return r490780;
}

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.4
Target4.1
Herbie4.1
\[\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 < -4.0985217869339084e-16

    1. Initial program 2.4

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right) \cdot \sqrt[3]{\frac{t}{1 - z}}}\right)\]
    4. Applied div-inv3.0

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

      \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(y, \frac{1}{z}, -\sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)\right)}\]
    6. Applied distribute-lft-in3.0

      \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(y, \frac{1}{z}, -\sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right) + x \cdot \mathsf{fma}\left(-\sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)}\]
    7. Simplified2.5

      \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(y, \frac{1}{z}, -\frac{t}{1 - z} \cdot 1\right)} + x \cdot \mathsf{fma}\left(-\sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)\]
    8. Simplified2.5

      \[\leadsto x \cdot \mathsf{fma}\left(y, \frac{1}{z}, -\frac{t}{1 - z} \cdot 1\right) + \color{blue}{x \cdot \left(\frac{t}{1 - z} \cdot \left(\left(-1\right) + 1\right)\right)}\]
    9. Using strategy rm
    10. Applied fma-udef2.5

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

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

    if -4.0985217869339084e-16 < x

    1. Initial program 5.0

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right) \cdot \sqrt[3]{\frac{t}{1 - z}}}\right)\]
    4. Applied div-inv5.4

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

      \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(y, \frac{1}{z}, -\sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)\right)}\]
    6. Applied distribute-lft-in5.4

      \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(y, \frac{1}{z}, -\sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right) + x \cdot \mathsf{fma}\left(-\sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)}\]
    7. Simplified5.0

      \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(y, \frac{1}{z}, -\frac{t}{1 - z} \cdot 1\right)} + x \cdot \mathsf{fma}\left(-\sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}, \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)\]
    8. Simplified5.0

      \[\leadsto x \cdot \mathsf{fma}\left(y, \frac{1}{z}, -\frac{t}{1 - z} \cdot 1\right) + \color{blue}{x \cdot \left(\frac{t}{1 - z} \cdot \left(\left(-1\right) + 1\right)\right)}\]
    9. Using strategy rm
    10. Applied fma-udef5.0

      \[\leadsto x \cdot \color{blue}{\left(y \cdot \frac{1}{z} + \left(-\frac{t}{1 - z} \cdot 1\right)\right)} + x \cdot \left(\frac{t}{1 - z} \cdot \left(\left(-1\right) + 1\right)\right)\]
    11. Applied distribute-lft-in5.0

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

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

      \[\leadsto \left(\frac{x \cdot y}{z} + \color{blue}{\left(-x \cdot \frac{t}{1 - z}\right)}\right) + x \cdot \left(\frac{t}{1 - z} \cdot \left(\left(-1\right) + 1\right)\right)\]
    14. Using strategy rm
    15. Applied div-inv4.5

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

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

Reproduce

herbie shell --seed 2020035 +o rules:numerics
(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)))))