Average Error: 7.2 → 0.8
Time: 16.4s
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 -3.818540540467079267699977309316411928156 \cdot 10^{275}:\\ \;\;\;\;\frac{x \cdot \frac{1}{y - z}}{t - z}\\ \mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le 3.342850604960242252109859433923772722235 \cdot 10^{212}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \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 -3.818540540467079267699977309316411928156 \cdot 10^{275}:\\
\;\;\;\;\frac{x \cdot \frac{1}{y - z}}{t - z}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r452767 = x;
        double r452768 = y;
        double r452769 = z;
        double r452770 = r452768 - r452769;
        double r452771 = t;
        double r452772 = r452771 - r452769;
        double r452773 = r452770 * r452772;
        double r452774 = r452767 / r452773;
        return r452774;
}

double f(double x, double y, double z, double t) {
        double r452775 = y;
        double r452776 = z;
        double r452777 = r452775 - r452776;
        double r452778 = t;
        double r452779 = r452778 - r452776;
        double r452780 = r452777 * r452779;
        double r452781 = -3.818540540467079e+275;
        bool r452782 = r452780 <= r452781;
        double r452783 = x;
        double r452784 = 1.0;
        double r452785 = r452784 / r452777;
        double r452786 = r452783 * r452785;
        double r452787 = r452786 / r452779;
        double r452788 = 3.3428506049602423e+212;
        bool r452789 = r452780 <= r452788;
        double r452790 = r452783 / r452780;
        double r452791 = r452783 / r452779;
        double r452792 = r452791 / r452777;
        double r452793 = r452789 ? r452790 : r452792;
        double r452794 = r452782 ? r452787 : r452793;
        return r452794;
}

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.2
Target8.1
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 3 regimes
  2. if (* (- y z) (- t z)) < -3.818540540467079e+275

    1. Initial program 16.6

      \[\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 div-inv0.1

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

    if -3.818540540467079e+275 < (* (- y z) (- t z)) < 3.3428506049602423e+212

    1. Initial program 1.6

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

    if 3.3428506049602423e+212 < (* (- y z) (- t z))

    1. Initial program 11.6

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

      \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - z}}\]
    4. Using strategy rm
    5. Applied div-inv0.3

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

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

      \[\leadsto \frac{\color{blue}{\frac{x}{t - z}}}{y - z}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \le -3.818540540467079267699977309316411928156 \cdot 10^{275}:\\ \;\;\;\;\frac{x \cdot \frac{1}{y - z}}{t - z}\\ \mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le 3.342850604960242252109859433923772722235 \cdot 10^{212}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019325 +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))))