Average Error: 7.5 → 1.2
Time: 18.4s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;\left(t - z\right) \cdot \left(y - z\right) = -\infty:\\ \;\;\;\;\frac{1}{\frac{t - z}{\frac{x}{y - z}}}\\ \mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 7.073499185269093437018292211666512529491 \cdot 10^{141}:\\ \;\;\;\;x \cdot \frac{\frac{1}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t - z} \cdot \frac{1}{y - z}\\ \end{array}\]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
\mathbf{if}\;\left(t - z\right) \cdot \left(y - z\right) = -\infty:\\
\;\;\;\;\frac{1}{\frac{t - z}{\frac{x}{y - z}}}\\

\mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 7.073499185269093437018292211666512529491 \cdot 10^{141}:\\
\;\;\;\;x \cdot \frac{\frac{1}{y - z}}{t - z}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z} \cdot \frac{1}{y - z}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r38522485 = x;
        double r38522486 = y;
        double r38522487 = z;
        double r38522488 = r38522486 - r38522487;
        double r38522489 = t;
        double r38522490 = r38522489 - r38522487;
        double r38522491 = r38522488 * r38522490;
        double r38522492 = r38522485 / r38522491;
        return r38522492;
}

double f(double x, double y, double z, double t) {
        double r38522493 = t;
        double r38522494 = z;
        double r38522495 = r38522493 - r38522494;
        double r38522496 = y;
        double r38522497 = r38522496 - r38522494;
        double r38522498 = r38522495 * r38522497;
        double r38522499 = -inf.0;
        bool r38522500 = r38522498 <= r38522499;
        double r38522501 = 1.0;
        double r38522502 = x;
        double r38522503 = r38522502 / r38522497;
        double r38522504 = r38522495 / r38522503;
        double r38522505 = r38522501 / r38522504;
        double r38522506 = 7.073499185269093e+141;
        bool r38522507 = r38522498 <= r38522506;
        double r38522508 = r38522501 / r38522497;
        double r38522509 = r38522508 / r38522495;
        double r38522510 = r38522502 * r38522509;
        double r38522511 = r38522502 / r38522495;
        double r38522512 = r38522511 * r38522508;
        double r38522513 = r38522507 ? r38522510 : r38522512;
        double r38522514 = r38522500 ? r38522505 : r38522513;
        return r38522514;
}

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.5
Target8.1
Herbie1.2
\[\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 3 regimes
  2. if (* (- y z) (- t z)) < -inf.0

    1. Initial program 19.8

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
    2. Using strategy rm
    3. Applied associate-/r*0.1

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

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

    if -inf.0 < (* (- y z) (- t z)) < 7.073499185269093e+141

    1. Initial program 1.6

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
    2. Using strategy rm
    3. Applied associate-/r*3.9

      \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - z}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity3.9

      \[\leadsto \frac{\frac{x}{y - z}}{\color{blue}{1 \cdot \left(t - z\right)}}\]
    6. Applied div-inv4.0

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

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

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

    if 7.073499185269093e+141 < (* (- y z) (- t z))

    1. Initial program 10.4

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

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

      \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(t - z\right) \cdot \left(y - z\right) = -\infty:\\ \;\;\;\;\frac{1}{\frac{t - z}{\frac{x}{y - z}}}\\ \mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 7.073499185269093437018292211666512529491 \cdot 10^{141}:\\ \;\;\;\;x \cdot \frac{\frac{1}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{t - z} \cdot \frac{1}{y - z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019192 
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"

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

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