Average Error: 7.4 → 0.8
Time: 4.6s
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 -1.3710723791791016 \cdot 10^{201} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 3.15237795325171946 \cdot 10^{240}\right):\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{\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 -1.3710723791791016 \cdot 10^{201} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 3.15237795325171946 \cdot 10^{240}\right):\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r811907 = x;
        double r811908 = y;
        double r811909 = z;
        double r811910 = r811908 - r811909;
        double r811911 = t;
        double r811912 = r811911 - r811909;
        double r811913 = r811910 * r811912;
        double r811914 = r811907 / r811913;
        return r811914;
}

double f(double x, double y, double z, double t) {
        double r811915 = y;
        double r811916 = z;
        double r811917 = r811915 - r811916;
        double r811918 = t;
        double r811919 = r811918 - r811916;
        double r811920 = r811917 * r811919;
        double r811921 = -1.3710723791791016e+201;
        bool r811922 = r811920 <= r811921;
        double r811923 = 3.1523779532517195e+240;
        bool r811924 = r811920 <= r811923;
        double r811925 = !r811924;
        bool r811926 = r811922 || r811925;
        double r811927 = x;
        double r811928 = r811927 / r811917;
        double r811929 = r811928 / r811919;
        double r811930 = 1.0;
        double r811931 = r811930 / r811920;
        double r811932 = r811927 * r811931;
        double r811933 = r811926 ? r811929 : r811932;
        return r811933;
}

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.4
Target8.2
Herbie0.8
\[\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)) < -1.3710723791791016e+201 or 3.1523779532517195e+240 < (* (- y z) (- t z))

    1. Initial program 12.8

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

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

    if -1.3710723791791016e+201 < (* (- y z) (- t z)) < 3.1523779532517195e+240

    1. Initial program 1.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \le -1.3710723791791016 \cdot 10^{201} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 3.15237795325171946 \cdot 10^{240}\right):\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{\left(y - z\right) \cdot \left(t - z\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2020036 +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))))