Average Error: 7.7 → 1.5
Time: 8.8s
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 -7.10938901979545519 \cdot 10^{300} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le -2.4754507687590531 \cdot 10^{-14}\right):\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z} \cdot \sqrt{1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\ \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 -7.10938901979545519 \cdot 10^{300} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le -2.4754507687590531 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{\frac{x}{t - z}}{y - z} \cdot \sqrt{1}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r744950 = x;
        double r744951 = y;
        double r744952 = z;
        double r744953 = r744951 - r744952;
        double r744954 = t;
        double r744955 = r744954 - r744952;
        double r744956 = r744953 * r744955;
        double r744957 = r744950 / r744956;
        return r744957;
}

double f(double x, double y, double z, double t) {
        double r744958 = y;
        double r744959 = z;
        double r744960 = r744958 - r744959;
        double r744961 = t;
        double r744962 = r744961 - r744959;
        double r744963 = r744960 * r744962;
        double r744964 = -7.109389019795455e+300;
        bool r744965 = r744963 <= r744964;
        double r744966 = -2.475450768759053e-14;
        bool r744967 = r744963 <= r744966;
        double r744968 = !r744967;
        bool r744969 = r744965 || r744968;
        double r744970 = x;
        double r744971 = r744970 / r744962;
        double r744972 = r744971 / r744960;
        double r744973 = 1.0;
        double r744974 = sqrt(r744973);
        double r744975 = r744972 * r744974;
        double r744976 = r744962 * r744960;
        double r744977 = r744970 / r744976;
        double r744978 = r744969 ? r744975 : r744977;
        return r744978;
}

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.4
Herbie1.5
\[\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)) < -7.109389019795455e+300 or -2.475450768759053e-14 < (* (- y z) (- t z))

    1. Initial program 9.1

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

      \[\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}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity1.9

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

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

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

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

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

    if -7.109389019795455e+300 < (* (- y z) (- t z)) < -2.475450768759053e-14

    1. Initial program 0.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \le -7.10938901979545519 \cdot 10^{300} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le -2.4754507687590531 \cdot 10^{-14}\right):\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z} \cdot \sqrt{1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\ \end{array}\]

Reproduce

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