Average Error: 7.5 → 2.2
Time: 4.7s
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 6.34434390289444677 \cdot 10^{108}:\\ \;\;\;\;\frac{\sqrt{1}}{1} \cdot \frac{1}{\frac{y - z}{\frac{x}{t - z}}}\\ \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 6.34434390289444677 \cdot 10^{108}:\\
\;\;\;\;\frac{\sqrt{1}}{1} \cdot \frac{1}{\frac{y - z}{\frac{x}{t - z}}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r861039 = x;
        double r861040 = y;
        double r861041 = z;
        double r861042 = r861040 - r861041;
        double r861043 = t;
        double r861044 = r861043 - r861041;
        double r861045 = r861042 * r861044;
        double r861046 = r861039 / r861045;
        return r861046;
}

double f(double x, double y, double z, double t) {
        double r861047 = y;
        double r861048 = z;
        double r861049 = r861047 - r861048;
        double r861050 = t;
        double r861051 = r861050 - r861048;
        double r861052 = r861049 * r861051;
        double r861053 = 6.344343902894447e+108;
        bool r861054 = r861052 <= r861053;
        double r861055 = 1.0;
        double r861056 = sqrt(r861055);
        double r861057 = r861056 / r861055;
        double r861058 = x;
        double r861059 = r861058 / r861051;
        double r861060 = r861049 / r861059;
        double r861061 = r861055 / r861060;
        double r861062 = r861057 * r861061;
        double r861063 = r861058 / r861049;
        double r861064 = r861063 / r861051;
        double r861065 = r861054 ? r861062 : r861064;
        return r861065;
}

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.2
Herbie2.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 2 regimes
  2. if (* (- y z) (- t z)) < 6.344343902894447e+108

    1. Initial program 5.2

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

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

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

      \[\leadsto \frac{1}{\color{blue}{1 \cdot \left(y - z\right)}} \cdot \frac{x}{t - z}\]
    7. Applied add-sqr-sqrt3.5

      \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{1 \cdot \left(y - z\right)} \cdot \frac{x}{t - z}\]
    8. Applied times-frac3.5

      \[\leadsto \color{blue}{\left(\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{y - z}\right)} \cdot \frac{x}{t - z}\]
    9. Applied associate-*l*3.5

      \[\leadsto \color{blue}{\frac{\sqrt{1}}{1} \cdot \left(\frac{\sqrt{1}}{y - z} \cdot \frac{x}{t - z}\right)}\]
    10. Simplified3.4

      \[\leadsto \frac{\sqrt{1}}{1} \cdot \color{blue}{\frac{\frac{x}{t - z}}{y - z}}\]
    11. Using strategy rm
    12. Applied clear-num3.8

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

    if 6.344343902894447e+108 < (* (- y z) (- t z))

    1. Initial program 9.8

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

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

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

Reproduce

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