Average Error: 7.5 → 1.3
Time: 15.5s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \le 0.0:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - 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}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \le 0.0:\\
\;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - 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 r585141 = x;
        double r585142 = y;
        double r585143 = z;
        double r585144 = r585142 - r585143;
        double r585145 = t;
        double r585146 = r585145 - r585143;
        double r585147 = r585144 * r585146;
        double r585148 = r585141 / r585147;
        return r585148;
}

double f(double x, double y, double z, double t) {
        double r585149 = x;
        double r585150 = y;
        double r585151 = z;
        double r585152 = r585150 - r585151;
        double r585153 = t;
        double r585154 = r585153 - r585151;
        double r585155 = r585152 * r585154;
        double r585156 = r585149 / r585155;
        double r585157 = 0.0;
        bool r585158 = r585156 <= r585157;
        double r585159 = 1.0;
        double r585160 = r585159 / r585152;
        double r585161 = r585149 / r585154;
        double r585162 = r585160 * r585161;
        double r585163 = r585158 ? r585162 : r585156;
        return r585163;
}

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.4
Herbie1.3
\[\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 (/ x (* (- y z) (- t z))) < 0.0

    1. Initial program 7.7

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

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

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

    if 0.0 < (/ x (* (- y z) (- t z)))

    1. Initial program 7.3

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \le 0.0:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \end{array}\]

Reproduce

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