Average Error: 4.9 → 1.4
Time: 15.5s
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 3.400558014790777058962262750309459679079 \cdot 10^{303}\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 3.400558014790777058962262750309459679079 \cdot 10^{303}\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 r282808 = x;
        double r282809 = y;
        double r282810 = z;
        double r282811 = r282809 / r282810;
        double r282812 = t;
        double r282813 = 1.0;
        double r282814 = r282813 - r282810;
        double r282815 = r282812 / r282814;
        double r282816 = r282811 - r282815;
        double r282817 = r282808 * r282816;
        return r282817;
}

double f(double x, double y, double z, double t) {
        double r282818 = y;
        double r282819 = z;
        double r282820 = r282818 / r282819;
        double r282821 = t;
        double r282822 = 1.0;
        double r282823 = r282822 - r282819;
        double r282824 = r282821 / r282823;
        double r282825 = r282820 - r282824;
        double r282826 = -inf.0;
        bool r282827 = r282825 <= r282826;
        double r282828 = 3.400558014790777e+303;
        bool r282829 = r282825 <= r282828;
        double r282830 = !r282829;
        bool r282831 = r282827 || r282830;
        double r282832 = x;
        double r282833 = r282818 * r282823;
        double r282834 = r282819 * r282821;
        double r282835 = r282833 - r282834;
        double r282836 = r282832 * r282835;
        double r282837 = r282819 * r282823;
        double r282838 = r282836 / r282837;
        double r282839 = r282832 * r282825;
        double r282840 = r282831 ? r282838 : r282839;
        return r282840;
}

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.9
Target4.5
Herbie1.4
\[\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 3.400558014790777e+303 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 61.1

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

      \[\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.3

      \[\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))) < 3.400558014790777e+303

    1. Initial program 1.5

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

    \[\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 3.400558014790777058962262750309459679079 \cdot 10^{303}\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 2019297 
(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.62322630331204244e-196) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 1.41339449277023022e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z)))))))

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