Average Error: 4.6 → 5.0
Time: 40.7s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.091267182572035020597807740239632609615 \cdot 10^{91}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)\\ \mathbf{elif}\;z \le 6.088454965275129292107189702307645150553 \cdot 10^{-298}:\\ \;\;\;\;\frac{x \cdot \left(y \cdot \left(1 - z\right) - z \cdot t\right)}{z \cdot \left(1 - z\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
\mathbf{if}\;z \le -1.091267182572035020597807740239632609615 \cdot 10^{91}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \sqrt[3]{\frac{t}{1 - z}} \cdot \left(\sqrt[3]{\frac{t}{1 - z}} \cdot \sqrt[3]{\frac{t}{1 - z}}\right)\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r17085202 = x;
        double r17085203 = y;
        double r17085204 = z;
        double r17085205 = r17085203 / r17085204;
        double r17085206 = t;
        double r17085207 = 1.0;
        double r17085208 = r17085207 - r17085204;
        double r17085209 = r17085206 / r17085208;
        double r17085210 = r17085205 - r17085209;
        double r17085211 = r17085202 * r17085210;
        return r17085211;
}

double f(double x, double y, double z, double t) {
        double r17085212 = z;
        double r17085213 = -1.091267182572035e+91;
        bool r17085214 = r17085212 <= r17085213;
        double r17085215 = x;
        double r17085216 = y;
        double r17085217 = r17085216 / r17085212;
        double r17085218 = t;
        double r17085219 = 1.0;
        double r17085220 = r17085219 - r17085212;
        double r17085221 = r17085218 / r17085220;
        double r17085222 = cbrt(r17085221);
        double r17085223 = r17085222 * r17085222;
        double r17085224 = r17085222 * r17085223;
        double r17085225 = r17085217 - r17085224;
        double r17085226 = r17085215 * r17085225;
        double r17085227 = 6.088454965275129e-298;
        bool r17085228 = r17085212 <= r17085227;
        double r17085229 = r17085216 * r17085220;
        double r17085230 = r17085212 * r17085218;
        double r17085231 = r17085229 - r17085230;
        double r17085232 = r17085215 * r17085231;
        double r17085233 = r17085212 * r17085220;
        double r17085234 = r17085232 / r17085233;
        double r17085235 = r17085228 ? r17085234 : r17085226;
        double r17085236 = r17085214 ? r17085226 : r17085235;
        return r17085236;
}

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.6
Target4.2
Herbie5.0
\[\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 2 regimes
  2. if z < -1.091267182572035e+91 or 6.088454965275129e-298 < z

    1. Initial program 3.7

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

      \[\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)\]

    if -1.091267182572035e+91 < z < 6.088454965275129e-298

    1. Initial program 6.9

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

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

      \[\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 simplification5.0

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

Reproduce

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