Average Error: 4.8 → 1.3
Time: 17.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 \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 5.904265829548936645690003942262148511215 \cdot 10^{295}\right):\\ \;\;\;\;\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} - \frac{t}{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 \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 5.904265829548936645690003942262148511215 \cdot 10^{295}\right):\\
\;\;\;\;\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} - \frac{t}{1 - z}\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r276329 = x;
        double r276330 = y;
        double r276331 = z;
        double r276332 = r276330 / r276331;
        double r276333 = t;
        double r276334 = 1.0;
        double r276335 = r276334 - r276331;
        double r276336 = r276333 / r276335;
        double r276337 = r276332 - r276336;
        double r276338 = r276329 * r276337;
        return r276338;
}

double f(double x, double y, double z, double t) {
        double r276339 = y;
        double r276340 = z;
        double r276341 = r276339 / r276340;
        double r276342 = t;
        double r276343 = 1.0;
        double r276344 = r276343 - r276340;
        double r276345 = r276342 / r276344;
        double r276346 = r276341 - r276345;
        double r276347 = -inf.0;
        bool r276348 = r276346 <= r276347;
        double r276349 = 5.904265829548937e+295;
        bool r276350 = r276346 <= r276349;
        double r276351 = !r276350;
        bool r276352 = r276348 || r276351;
        double r276353 = x;
        double r276354 = r276339 * r276344;
        double r276355 = r276340 * r276342;
        double r276356 = r276354 - r276355;
        double r276357 = r276353 * r276356;
        double r276358 = r276340 * r276344;
        double r276359 = r276357 / r276358;
        double r276360 = r276353 * r276346;
        double r276361 = r276352 ? r276359 : r276360;
        return r276361;
}

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
Herbie1.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 2 regimes
  2. if (- (/ y z) (/ t (- 1.0 z))) < -inf.0 or 5.904265829548937e+295 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 57.9

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

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

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

    if -inf.0 < (- (/ y z) (/ t (- 1.0 z))) < 5.904265829548937e+295

    1. Initial program 1.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} = -\infty \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 5.904265829548936645690003942262148511215 \cdot 10^{295}\right):\\ \;\;\;\;\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} - \frac{t}{1 - z}\right)\\ \end{array}\]

Reproduce

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