Average Error: 7.7 → 1.4
Time: 17.1s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;\left(t - z\right) \cdot \left(y - z\right) \le -0.0:\\ \;\;\;\;\frac{x}{t - z} \cdot \frac{1}{y - z}\\ \mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 1.636232738758287 \cdot 10^{+98}:\\ \;\;\;\;x \cdot \frac{1}{\left(t - z\right) \cdot \left(y - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{t - z}{x}}}{y - z}\\ \end{array}\]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
\mathbf{if}\;\left(t - z\right) \cdot \left(y - z\right) \le -0.0:\\
\;\;\;\;\frac{x}{t - z} \cdot \frac{1}{y - z}\\

\mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 1.636232738758287 \cdot 10^{+98}:\\
\;\;\;\;x \cdot \frac{1}{\left(t - z\right) \cdot \left(y - z\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\frac{t - z}{x}}}{y - z}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r36192922 = x;
        double r36192923 = y;
        double r36192924 = z;
        double r36192925 = r36192923 - r36192924;
        double r36192926 = t;
        double r36192927 = r36192926 - r36192924;
        double r36192928 = r36192925 * r36192927;
        double r36192929 = r36192922 / r36192928;
        return r36192929;
}

double f(double x, double y, double z, double t) {
        double r36192930 = t;
        double r36192931 = z;
        double r36192932 = r36192930 - r36192931;
        double r36192933 = y;
        double r36192934 = r36192933 - r36192931;
        double r36192935 = r36192932 * r36192934;
        double r36192936 = -0.0;
        bool r36192937 = r36192935 <= r36192936;
        double r36192938 = x;
        double r36192939 = r36192938 / r36192932;
        double r36192940 = 1.0;
        double r36192941 = r36192940 / r36192934;
        double r36192942 = r36192939 * r36192941;
        double r36192943 = 1.636232738758287e+98;
        bool r36192944 = r36192935 <= r36192943;
        double r36192945 = r36192940 / r36192935;
        double r36192946 = r36192938 * r36192945;
        double r36192947 = r36192932 / r36192938;
        double r36192948 = r36192940 / r36192947;
        double r36192949 = r36192948 / r36192934;
        double r36192950 = r36192944 ? r36192946 : r36192949;
        double r36192951 = r36192937 ? r36192942 : r36192950;
        return r36192951;
}

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.4
\[\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 3 regimes
  2. if (* (- y z) (- t z)) < -0.0

    1. Initial program 8.2

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

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

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

    if -0.0 < (* (- y z) (- t z)) < 1.636232738758287e+98

    1. Initial program 0.3

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

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

    if 1.636232738758287e+98 < (* (- y z) (- t z))

    1. Initial program 9.8

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

      \[\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.7

      \[\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 associate-*l/1.0

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

      \[\leadsto \frac{\color{blue}{\frac{x}{t - z}}}{y - z}\]
    8. Using strategy rm
    9. Applied clear-num0.7

      \[\leadsto \frac{\color{blue}{\frac{1}{\frac{t - z}{x}}}}{y - z}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(t - z\right) \cdot \left(y - z\right) \le -0.0:\\ \;\;\;\;\frac{x}{t - z} \cdot \frac{1}{y - z}\\ \mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 1.636232738758287 \cdot 10^{+98}:\\ \;\;\;\;x \cdot \frac{1}{\left(t - z\right) \cdot \left(y - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{t - z}{x}}}{y - z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019162 +o rules:numerics
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"

  :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))))