Average Error: 7.7 → 1.5
Time: 11.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}\\ \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 r963834 = x;
        double r963835 = y;
        double r963836 = z;
        double r963837 = r963835 - r963836;
        double r963838 = t;
        double r963839 = r963838 - r963836;
        double r963840 = r963837 * r963839;
        double r963841 = r963834 / r963840;
        return r963841;
}

double f(double x, double y, double z, double t) {
        double r963842 = y;
        double r963843 = z;
        double r963844 = r963842 - r963843;
        double r963845 = t;
        double r963846 = r963845 - r963843;
        double r963847 = r963844 * r963846;
        double r963848 = -7.109389019795455e+300;
        bool r963849 = r963847 <= r963848;
        double r963850 = -2.475450768759053e-14;
        bool r963851 = r963847 <= r963850;
        double r963852 = !r963851;
        bool r963853 = r963849 || r963852;
        double r963854 = x;
        double r963855 = r963854 / r963846;
        double r963856 = r963855 / r963844;
        double r963857 = r963854 / r963847;
        double r963858 = r963853 ? r963856 : r963857;
        return r963858;
}

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 *-un-lft-identity5.5

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{\frac{x}{y - z}}{t - z}}\]
    9. Using strategy rm
    10. Applied div-inv4.3

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

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

      \[\leadsto 1 \cdot \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 +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))))