Average Error: 4.8 → 3.6
Time: 1.3m
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;z \le -1458.7103711664122:\\ \;\;\;\;\left(\frac{y}{z} - \frac{1}{1.0 - z} \cdot t\right) \cdot x\\ \mathbf{elif}\;z \le 1.9908800588882296 \cdot 10^{-144}:\\ \;\;\;\;\frac{\left(\sqrt[3]{1.0 - z} \cdot y - \frac{\frac{z \cdot t}{\sqrt[3]{1.0 - z}}}{\sqrt[3]{1.0 - z}}\right) \cdot x}{z \cdot \sqrt[3]{1.0 - z}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{z} - \frac{1}{1.0 - z} \cdot t\right) \cdot x\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1.0 - z}\right)
\begin{array}{l}
\mathbf{if}\;z \le -1458.7103711664122:\\
\;\;\;\;\left(\frac{y}{z} - \frac{1}{1.0 - z} \cdot t\right) \cdot x\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r9491185 = x;
        double r9491186 = y;
        double r9491187 = z;
        double r9491188 = r9491186 / r9491187;
        double r9491189 = t;
        double r9491190 = 1.0;
        double r9491191 = r9491190 - r9491187;
        double r9491192 = r9491189 / r9491191;
        double r9491193 = r9491188 - r9491192;
        double r9491194 = r9491185 * r9491193;
        return r9491194;
}

double f(double x, double y, double z, double t) {
        double r9491195 = z;
        double r9491196 = -1458.7103711664122;
        bool r9491197 = r9491195 <= r9491196;
        double r9491198 = y;
        double r9491199 = r9491198 / r9491195;
        double r9491200 = 1.0;
        double r9491201 = 1.0;
        double r9491202 = r9491201 - r9491195;
        double r9491203 = r9491200 / r9491202;
        double r9491204 = t;
        double r9491205 = r9491203 * r9491204;
        double r9491206 = r9491199 - r9491205;
        double r9491207 = x;
        double r9491208 = r9491206 * r9491207;
        double r9491209 = 1.9908800588882296e-144;
        bool r9491210 = r9491195 <= r9491209;
        double r9491211 = cbrt(r9491202);
        double r9491212 = r9491211 * r9491198;
        double r9491213 = r9491195 * r9491204;
        double r9491214 = r9491213 / r9491211;
        double r9491215 = r9491214 / r9491211;
        double r9491216 = r9491212 - r9491215;
        double r9491217 = r9491216 * r9491207;
        double r9491218 = r9491195 * r9491211;
        double r9491219 = r9491217 / r9491218;
        double r9491220 = r9491210 ? r9491219 : r9491208;
        double r9491221 = r9491197 ? r9491208 : r9491220;
        return r9491221;
}

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.8
Target4.5
Herbie3.6
\[\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}{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}{1.0 - z}\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -1458.7103711664122 or 1.9908800588882296e-144 < z

    1. Initial program 2.5

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\frac{1}{\frac{1.0 - z}{t}}}\right)\]
    4. Using strategy rm
    5. Applied div-inv2.6

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

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

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

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

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

    if -1458.7103711664122 < z < 1.9908800588882296e-144

    1. Initial program 10.0

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

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

      \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\frac{\frac{t}{\sqrt[3]{1.0 - z} \cdot \sqrt[3]{1.0 - z}}}{\sqrt[3]{1.0 - z}}}\right)\]
    5. Applied *-un-lft-identity10.0

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

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

      \[\leadsto x \cdot \color{blue}{\frac{\frac{y}{1} \cdot \sqrt[3]{1.0 - z} - z \cdot \frac{t}{\sqrt[3]{1.0 - z} \cdot \sqrt[3]{1.0 - z}}}{z \cdot \sqrt[3]{1.0 - z}}}\]
    8. Applied associate-*r/6.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1458.7103711664122:\\ \;\;\;\;\left(\frac{y}{z} - \frac{1}{1.0 - z} \cdot t\right) \cdot x\\ \mathbf{elif}\;z \le 1.9908800588882296 \cdot 10^{-144}:\\ \;\;\;\;\frac{\left(\sqrt[3]{1.0 - z} \cdot y - \frac{\frac{z \cdot t}{\sqrt[3]{1.0 - z}}}{\sqrt[3]{1.0 - z}}\right) \cdot x}{z \cdot \sqrt[3]{1.0 - z}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{z} - \frac{1}{1.0 - z} \cdot t\right) \cdot x\\ \end{array}\]

Reproduce

herbie shell --seed 2019158 
(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 (- 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 (- 1.0 z)))))))

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