Average Error: 7.4 → 0.8
Time: 15.0s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \le -4.642374869806412710677867180496847109412 \cdot 10^{186} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 1.230917874548035135553559550835933941741 \cdot 10^{242}\right):\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \end{array}\]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
\mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \le -4.642374869806412710677867180496847109412 \cdot 10^{186} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 1.230917874548035135553559550835933941741 \cdot 10^{242}\right):\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r555602 = x;
        double r555603 = y;
        double r555604 = z;
        double r555605 = r555603 - r555604;
        double r555606 = t;
        double r555607 = r555606 - r555604;
        double r555608 = r555605 * r555607;
        double r555609 = r555602 / r555608;
        return r555609;
}

double f(double x, double y, double z, double t) {
        double r555610 = y;
        double r555611 = z;
        double r555612 = r555610 - r555611;
        double r555613 = t;
        double r555614 = r555613 - r555611;
        double r555615 = r555612 * r555614;
        double r555616 = -4.642374869806413e+186;
        bool r555617 = r555615 <= r555616;
        double r555618 = 1.2309178745480351e+242;
        bool r555619 = r555615 <= r555618;
        double r555620 = !r555619;
        bool r555621 = r555617 || r555620;
        double r555622 = x;
        double r555623 = r555622 / r555612;
        double r555624 = r555623 / r555614;
        double r555625 = r555622 / r555615;
        double r555626 = r555621 ? r555624 : r555625;
        return r555626;
}

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

Original7.4
Target8.3
Herbie0.8
\[\begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \lt 0.0:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{\left(y - z\right) \cdot \left(t - z\right)}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (* (- y z) (- t z)) < -4.642374869806413e+186 or 1.2309178745480351e+242 < (* (- y z) (- t z))

    1. Initial program 12.7

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity12.7

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{\left(y - z\right) \cdot \left(t - z\right)}\]
    4. Applied times-frac0.2

      \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity0.2

      \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{y - z}\right)} \cdot \frac{x}{t - z}\]
    7. Applied associate-*l*0.2

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

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

    if -4.642374869806413e+186 < (* (- y z) (- t z)) < 1.2309178745480351e+242

    1. Initial program 1.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \le -4.642374869806412710677867180496847109412 \cdot 10^{186} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 1.230917874548035135553559550835933941741 \cdot 10^{242}\right):\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2019209 +o rules:numerics
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"
  :precision binary64

  :herbie-target
  (if (< (/ x (* (- y z) (- t z))) 0.0) (/ (/ x (- y z)) (- t z)) (* x (/ 1 (* (- y z) (- t z)))))

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