Average Error: 7.7 → 1.2
Time: 5.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) \le -2.89579810626969026095077558126418128097 \cdot 10^{70}:\\ \;\;\;\;\frac{\frac{1}{y - z}}{\frac{t - z}{x}}\\ \mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le 3.319695875271514127355230850513732805532 \cdot 10^{169}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - 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 -2.89579810626969026095077558126418128097 \cdot 10^{70}:\\
\;\;\;\;\frac{\frac{1}{y - z}}{\frac{t - z}{x}}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r782067 = x;
        double r782068 = y;
        double r782069 = z;
        double r782070 = r782068 - r782069;
        double r782071 = t;
        double r782072 = r782071 - r782069;
        double r782073 = r782070 * r782072;
        double r782074 = r782067 / r782073;
        return r782074;
}

double f(double x, double y, double z, double t) {
        double r782075 = y;
        double r782076 = z;
        double r782077 = r782075 - r782076;
        double r782078 = t;
        double r782079 = r782078 - r782076;
        double r782080 = r782077 * r782079;
        double r782081 = -2.89579810626969e+70;
        bool r782082 = r782080 <= r782081;
        double r782083 = 1.0;
        double r782084 = r782083 / r782077;
        double r782085 = x;
        double r782086 = r782079 / r782085;
        double r782087 = r782084 / r782086;
        double r782088 = 3.319695875271514e+169;
        bool r782089 = r782080 <= r782088;
        double r782090 = r782085 / r782080;
        double r782091 = r782085 / r782077;
        double r782092 = r782091 / r782079;
        double r782093 = r782089 ? r782090 : r782092;
        double r782094 = r782082 ? r782087 : r782093;
        return r782094;
}

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.7
Target8.5
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)) < -2.89579810626969e+70

    1. Initial program 8.1

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{\frac{y - z}{x}}}}{t - z}\]
    6. Using strategy rm
    7. Applied div-inv2.3

      \[\leadsto \frac{\frac{1}{\color{blue}{\left(y - z\right) \cdot \frac{1}{x}}}}{t - z}\]
    8. Applied *-un-lft-identity2.3

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

      \[\leadsto \frac{\color{blue}{\frac{1}{y - z} \cdot \frac{1}{\frac{1}{x}}}}{t - z}\]
    10. Applied associate-/l*1.7

      \[\leadsto \color{blue}{\frac{\frac{1}{y - z}}{\frac{t - z}{\frac{1}{\frac{1}{x}}}}}\]
    11. Simplified1.6

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

    if -2.89579810626969e+70 < (* (- y z) (- t z)) < 3.319695875271514e+169

    1. Initial program 2.2

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

    if 3.319695875271514e+169 < (* (- 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.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \le -2.89579810626969026095077558126418128097 \cdot 10^{70}:\\ \;\;\;\;\frac{\frac{1}{y - z}}{\frac{t - z}{x}}\\ \mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le 3.319695875271514127355230850513732805532 \cdot 10^{169}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \end{array}\]

Reproduce

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