Average Error: 4.7 → 4.0
Time: 22.0s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.326070211954311 \cdot 10^{-155} \lor \neg \left(z \le 9213813770804897800\right):\\ \;\;\;\;x \cdot \left(\left(\frac{y}{z} - \frac{{\left(\sqrt[3]{t}\right)}^{3}}{1 - z}\right) + \left(\frac{{\left(\sqrt[3]{t}\right)}^{3}}{1 - z} - \frac{{\left(\sqrt[3]{t}\right)}^{3}}{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}\;z \le -2.326070211954311 \cdot 10^{-155} \lor \neg \left(z \le 9213813770804897800\right):\\
\;\;\;\;x \cdot \left(\left(\frac{y}{z} - \frac{{\left(\sqrt[3]{t}\right)}^{3}}{1 - z}\right) + \left(\frac{{\left(\sqrt[3]{t}\right)}^{3}}{1 - z} - \frac{{\left(\sqrt[3]{t}\right)}^{3}}{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 r568054 = x;
        double r568055 = y;
        double r568056 = z;
        double r568057 = r568055 / r568056;
        double r568058 = t;
        double r568059 = 1.0;
        double r568060 = r568059 - r568056;
        double r568061 = r568058 / r568060;
        double r568062 = r568057 - r568061;
        double r568063 = r568054 * r568062;
        return r568063;
}

double f(double x, double y, double z, double t) {
        double r568064 = z;
        double r568065 = -2.3260702119543115e-155;
        bool r568066 = r568064 <= r568065;
        double r568067 = 9.213813770804898e+18;
        bool r568068 = r568064 <= r568067;
        double r568069 = !r568068;
        bool r568070 = r568066 || r568069;
        double r568071 = x;
        double r568072 = y;
        double r568073 = r568072 / r568064;
        double r568074 = t;
        double r568075 = cbrt(r568074);
        double r568076 = 3.0;
        double r568077 = pow(r568075, r568076);
        double r568078 = 1.0;
        double r568079 = r568078 - r568064;
        double r568080 = r568077 / r568079;
        double r568081 = r568073 - r568080;
        double r568082 = r568080 - r568080;
        double r568083 = r568081 + r568082;
        double r568084 = r568071 * r568083;
        double r568085 = r568072 * r568079;
        double r568086 = r568064 * r568074;
        double r568087 = r568085 - r568086;
        double r568088 = r568071 * r568087;
        double r568089 = r568064 * r568079;
        double r568090 = r568088 / r568089;
        double r568091 = r568070 ? r568084 : r568090;
        return r568091;
}

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.3
Herbie4.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 z < -2.3260702119543115e-155 or 9.213813770804898e+18 < z

    1. Initial program 2.6

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \frac{t}{\color{blue}{1 \cdot \left(1 - z\right)}}\right)\]
    4. Applied add-cube-cbrt3.0

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{1} \cdot \frac{\sqrt[3]{t}}{1 - z}}\right)\]
    6. Applied add-sqr-sqrt27.3

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

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

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

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

    if -2.3260702119543115e-155 < z < 9.213813770804898e+18

    1. Initial program 9.6

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

      \[\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/6.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.326070211954311 \cdot 10^{-155} \lor \neg \left(z \le 9213813770804897800\right):\\ \;\;\;\;x \cdot \left(\left(\frac{y}{z} - \frac{{\left(\sqrt[3]{t}\right)}^{3}}{1 - z}\right) + \left(\frac{{\left(\sqrt[3]{t}\right)}^{3}}{1 - z} - \frac{{\left(\sqrt[3]{t}\right)}^{3}}{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 2020042 +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)))))