Average Error: 4.7 → 4.8
Time: 13.5s
Precision: 64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)
double f(double x, double y, double z, double t) {
        double r276154 = x;
        double r276155 = y;
        double r276156 = z;
        double r276157 = r276155 / r276156;
        double r276158 = t;
        double r276159 = 1.0;
        double r276160 = r276159 - r276156;
        double r276161 = r276158 / r276160;
        double r276162 = r276157 - r276161;
        double r276163 = r276154 * r276162;
        return r276163;
}

double f(double x, double y, double z, double t) {
        double r276164 = x;
        double r276165 = y;
        double r276166 = z;
        double r276167 = r276165 / r276166;
        double r276168 = t;
        double r276169 = 1.0;
        double r276170 = 1.0;
        double r276171 = r276170 - r276166;
        double r276172 = r276169 / r276171;
        double r276173 = r276168 * r276172;
        double r276174 = r276167 - r276173;
        double r276175 = r276164 * r276174;
        return r276175;
}

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.7
Target4.3
Herbie4.8
\[\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 8.142281339311981e+291 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 54.9

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
    2. Using strategy rm
    3. Applied frac-sub55.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.4

      \[\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))) < 8.142281339311981e+291

    1. Initial program 1.4

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

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

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

Reproduce

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