Average Error: 7.5 → 0.8
Time: 17.6s
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) \le -4.190756372512900814987605516986406657008 \cdot 10^{266}:\\ \;\;\;\;\frac{1}{t - z} \cdot \frac{x}{y - z}\\ \mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 2.200137412877628968473146395711500261123 \cdot 10^{306}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - 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) \le -4.190756372512900814987605516986406657008 \cdot 10^{266}:\\
\;\;\;\;\frac{1}{t - z} \cdot \frac{x}{y - z}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r33321613 = x;
        double r33321614 = y;
        double r33321615 = z;
        double r33321616 = r33321614 - r33321615;
        double r33321617 = t;
        double r33321618 = r33321617 - r33321615;
        double r33321619 = r33321616 * r33321618;
        double r33321620 = r33321613 / r33321619;
        return r33321620;
}

double f(double x, double y, double z, double t) {
        double r33321621 = t;
        double r33321622 = z;
        double r33321623 = r33321621 - r33321622;
        double r33321624 = y;
        double r33321625 = r33321624 - r33321622;
        double r33321626 = r33321623 * r33321625;
        double r33321627 = -4.190756372512901e+266;
        bool r33321628 = r33321626 <= r33321627;
        double r33321629 = 1.0;
        double r33321630 = r33321629 / r33321623;
        double r33321631 = x;
        double r33321632 = r33321631 / r33321625;
        double r33321633 = r33321630 * r33321632;
        double r33321634 = 2.200137412877629e+306;
        bool r33321635 = r33321626 <= r33321634;
        double r33321636 = r33321631 / r33321626;
        double r33321637 = r33321629 / r33321625;
        double r33321638 = r33321631 / r33321623;
        double r33321639 = r33321637 * r33321638;
        double r33321640 = r33321635 ? r33321636 : r33321639;
        double r33321641 = r33321628 ? r33321633 : r33321640;
        return r33321641;
}

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
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)) < -4.190756372512901e+266

    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.2

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

    if -4.190756372512901e+266 < (* (- y z) (- t z)) < 2.200137412877629e+306

    1. Initial program 1.2

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

    if 2.200137412877629e+306 < (* (- y z) (- t z))

    1. Initial program 15.9

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

      \[\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}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(t - z\right) \cdot \left(y - z\right) \le -4.190756372512900814987605516986406657008 \cdot 10^{266}:\\ \;\;\;\;\frac{1}{t - z} \cdot \frac{x}{y - z}\\ \mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 2.200137412877628968473146395711500261123 \cdot 10^{306}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019192 +o rules:numerics
(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))))