Average Error: 7.7 → 1.5
Time: 10.3s
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}\\ \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}\;\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}\\

\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 r674895 = x;
        double r674896 = y;
        double r674897 = z;
        double r674898 = r674896 - r674897;
        double r674899 = t;
        double r674900 = r674899 - r674897;
        double r674901 = r674898 * r674900;
        double r674902 = r674895 / r674901;
        return r674902;
}

double f(double x, double y, double z, double t) {
        double r674903 = y;
        double r674904 = z;
        double r674905 = r674903 - r674904;
        double r674906 = t;
        double r674907 = r674906 - r674904;
        double r674908 = r674905 * r674907;
        double r674909 = -7.109389019795455e+300;
        bool r674910 = r674908 <= r674909;
        double r674911 = -2.475450768759053e-14;
        bool r674912 = r674908 <= r674911;
        double r674913 = !r674912;
        bool r674914 = r674910 || r674913;
        double r674915 = x;
        double r674916 = r674915 / r674907;
        double r674917 = r674916 / r674905;
        double r674918 = r674915 / r674908;
        double r674919 = r674914 ? r674917 : r674918;
        return r674919;
}

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 associate-*l/1.8

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

      \[\leadsto \frac{\color{blue}{\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 *-un-lft-identity0.2

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

      \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}}\]
    5. Using strategy rm
    6. Applied associate-*l/5.4

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

      \[\leadsto \frac{\color{blue}{\frac{x}{t - z}}}{y - z}\]
    8. Using strategy rm
    9. Applied div-inv5.5

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

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

      \[\leadsto \frac{x}{\color{blue}{\left(y - z\right) \cdot \left(t - 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}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - 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))))