Average Error: 4.5 → 0.3
Time: 5.0s
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 \frac{y \cdot \left(1 - z\right) - z \cdot t}{1}}{z \cdot \left(1 - z\right)}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -2.78381369030126933781218479946675720907 \cdot 10^{-264}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 7.010228289444063733682275068254429974158 \cdot 10^{-231}:\\ \;\;\;\;\frac{x \cdot y}{z} + \left(1 \cdot \frac{t \cdot x}{{z}^{2}} + \left(t \cdot x\right) \cdot \frac{1}{z}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.795095217187765936797771641264103283314 \cdot 10^{286}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{y \cdot \left(1 - z\right) - z \cdot t}{1}}{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 \frac{y \cdot \left(1 - z\right) - z \cdot t}{1}}{z \cdot \left(1 - z\right)}\\

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -2.78381369030126933781218479946675720907 \cdot 10^{-264}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\

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

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.795095217187765936797771641264103283314 \cdot 10^{286}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r385137 = x;
        double r385138 = y;
        double r385139 = z;
        double r385140 = r385138 / r385139;
        double r385141 = t;
        double r385142 = 1.0;
        double r385143 = r385142 - r385139;
        double r385144 = r385141 / r385143;
        double r385145 = r385140 - r385144;
        double r385146 = r385137 * r385145;
        return r385146;
}

double f(double x, double y, double z, double t) {
        double r385147 = y;
        double r385148 = z;
        double r385149 = r385147 / r385148;
        double r385150 = t;
        double r385151 = 1.0;
        double r385152 = r385151 - r385148;
        double r385153 = r385150 / r385152;
        double r385154 = r385149 - r385153;
        double r385155 = -inf.0;
        bool r385156 = r385154 <= r385155;
        double r385157 = x;
        double r385158 = r385147 * r385152;
        double r385159 = r385148 * r385150;
        double r385160 = r385158 - r385159;
        double r385161 = 1.0;
        double r385162 = r385160 / r385161;
        double r385163 = r385157 * r385162;
        double r385164 = r385148 * r385152;
        double r385165 = r385163 / r385164;
        double r385166 = -2.7838136903012693e-264;
        bool r385167 = r385154 <= r385166;
        double r385168 = r385157 * r385154;
        double r385169 = 7.010228289444064e-231;
        bool r385170 = r385154 <= r385169;
        double r385171 = r385157 * r385147;
        double r385172 = r385171 / r385148;
        double r385173 = r385150 * r385157;
        double r385174 = 2.0;
        double r385175 = pow(r385148, r385174);
        double r385176 = r385173 / r385175;
        double r385177 = r385151 * r385176;
        double r385178 = r385161 / r385148;
        double r385179 = r385173 * r385178;
        double r385180 = r385177 + r385179;
        double r385181 = r385172 + r385180;
        double r385182 = 1.795095217187766e+286;
        bool r385183 = r385154 <= r385182;
        double r385184 = r385183 ? r385168 : r385165;
        double r385185 = r385170 ? r385181 : r385184;
        double r385186 = r385167 ? r385168 : r385185;
        double r385187 = r385156 ? r385165 : r385186;
        return r385187;
}

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.1
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \lt -7.623226303312042442144691872793570510727 \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.413394492770230216018398633584271456447 \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 1.795095217187766e+286 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 53.4

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

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

      \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\right)}\]
    5. Using strategy rm
    6. Applied frac-sub53.9

      \[\leadsto \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \color{blue}{\frac{y \cdot \left(1 - z\right) - z \cdot t}{z \cdot \left(1 - z\right)}}\right)\]
    7. Applied associate-*r/31.3

      \[\leadsto \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \color{blue}{\frac{\sqrt[3]{x} \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}}\]
    8. Applied associate-*r/1.7

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

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

    if -inf.0 < (- (/ y z) (/ t (- 1.0 z))) < -2.7838136903012693e-264 or 7.010228289444064e-231 < (- (/ y z) (/ t (- 1.0 z))) < 1.795095217187766e+286

    1. Initial program 0.2

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

    if -2.7838136903012693e-264 < (- (/ y z) (/ t (- 1.0 z))) < 7.010228289444064e-231

    1. Initial program 11.8

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z} + \left(1 \cdot \frac{t \cdot x}{{z}^{2}} + \frac{t \cdot x}{z}\right)}\]
    6. Using strategy rm
    7. Applied div-inv0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} = -\infty:\\ \;\;\;\;\frac{x \cdot \frac{y \cdot \left(1 - z\right) - z \cdot t}{1}}{z \cdot \left(1 - z\right)}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le -2.78381369030126933781218479946675720907 \cdot 10^{-264}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 7.010228289444063733682275068254429974158 \cdot 10^{-231}:\\ \;\;\;\;\frac{x \cdot y}{z} + \left(1 \cdot \frac{t \cdot x}{{z}^{2}} + \left(t \cdot x\right) \cdot \frac{1}{z}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 1.795095217187765936797771641264103283314 \cdot 10^{286}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{y \cdot \left(1 - z\right) - z \cdot t}{1}}{z \cdot \left(1 - z\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2019354 
(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)))))