Average Error: 7.5 → 1.1
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 -3.8613496221902048 \cdot 10^{167} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 4.10725892761908993 \cdot 10^{100}\right):\\ \;\;\;\;1 \cdot \frac{\frac{x}{y - z}}{t - 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 -3.8613496221902048 \cdot 10^{167} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 4.10725892761908993 \cdot 10^{100}\right):\\
\;\;\;\;1 \cdot \frac{\frac{x}{y - z}}{t - 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 r647820 = x;
        double r647821 = y;
        double r647822 = z;
        double r647823 = r647821 - r647822;
        double r647824 = t;
        double r647825 = r647824 - r647822;
        double r647826 = r647823 * r647825;
        double r647827 = r647820 / r647826;
        return r647827;
}

double f(double x, double y, double z, double t) {
        double r647828 = y;
        double r647829 = z;
        double r647830 = r647828 - r647829;
        double r647831 = t;
        double r647832 = r647831 - r647829;
        double r647833 = r647830 * r647832;
        double r647834 = -3.861349622190205e+167;
        bool r647835 = r647833 <= r647834;
        double r647836 = 4.10725892761909e+100;
        bool r647837 = r647833 <= r647836;
        double r647838 = !r647837;
        bool r647839 = r647835 || r647838;
        double r647840 = 1.0;
        double r647841 = x;
        double r647842 = r647841 / r647830;
        double r647843 = r647842 / r647832;
        double r647844 = r647840 * r647843;
        double r647845 = r647841 / r647833;
        double r647846 = r647839 ? r647844 : r647845;
        return r647846;
}

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.3
Herbie1.1
\[\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)) < -3.861349622190205e+167 or 4.10725892761909e+100 < (* (- y z) (- t z))

    1. Initial program 10.1

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

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

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

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

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

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

    if -3.861349622190205e+167 < (* (- y z) (- t z)) < 4.10725892761909e+100

    1. Initial program 2.0

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

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

Reproduce

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