Average Error: 7.6 → 0.8
Time: 4.1s
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) = -\infty \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 1.07579941892789198 \cdot 10^{305}\right):\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - 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) = -\infty \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 1.07579941892789198 \cdot 10^{305}\right):\\
\;\;\;\;\frac{\frac{x}{t - z}}{y - 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 r690465 = x;
        double r690466 = y;
        double r690467 = z;
        double r690468 = r690466 - r690467;
        double r690469 = t;
        double r690470 = r690469 - r690467;
        double r690471 = r690468 * r690470;
        double r690472 = r690465 / r690471;
        return r690472;
}

double f(double x, double y, double z, double t) {
        double r690473 = y;
        double r690474 = z;
        double r690475 = r690473 - r690474;
        double r690476 = t;
        double r690477 = r690476 - r690474;
        double r690478 = r690475 * r690477;
        double r690479 = -inf.0;
        bool r690480 = r690478 <= r690479;
        double r690481 = 1.075799418927892e+305;
        bool r690482 = r690478 <= r690481;
        double r690483 = !r690482;
        bool r690484 = r690480 || r690483;
        double r690485 = x;
        double r690486 = r690485 / r690477;
        double r690487 = r690486 / r690475;
        double r690488 = r690485 / r690478;
        double r690489 = r690484 ? r690487 : r690488;
        return r690489;
}

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.6
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)) < -inf.0 or 1.075799418927892e+305 < (* (- y z) (- t z))

    1. Initial program 16.8

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

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

      \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}}\]
    5. Using strategy rm
    6. Applied clear-num0.1

      \[\leadsto \frac{1}{y - z} \cdot \color{blue}{\frac{1}{\frac{t - z}{x}}}\]
    7. Using strategy rm
    8. Applied associate-*l/0.1

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

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

    if -inf.0 < (* (- y z) (- t z)) < 1.075799418927892e+305

    1. Initial program 1.3

      \[\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) = -\infty \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 1.07579941892789198 \cdot 10^{305}\right):\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \end{array}\]

Reproduce

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