Average Error: 7.4 → 1.0
Time: 44.2s
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) = -\infty:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 5.471205735338041489015307420563816280698 \cdot 10^{122}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y - z} \cdot \frac{1}{t - 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) = -\infty:\\
\;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\

\mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 5.471205735338041489015307420563816280698 \cdot 10^{122}:\\
\;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r38949136 = x;
        double r38949137 = y;
        double r38949138 = z;
        double r38949139 = r38949137 - r38949138;
        double r38949140 = t;
        double r38949141 = r38949140 - r38949138;
        double r38949142 = r38949139 * r38949141;
        double r38949143 = r38949136 / r38949142;
        return r38949143;
}

double f(double x, double y, double z, double t) {
        double r38949144 = t;
        double r38949145 = z;
        double r38949146 = r38949144 - r38949145;
        double r38949147 = y;
        double r38949148 = r38949147 - r38949145;
        double r38949149 = r38949146 * r38949148;
        double r38949150 = -inf.0;
        bool r38949151 = r38949149 <= r38949150;
        double r38949152 = x;
        double r38949153 = r38949152 / r38949146;
        double r38949154 = r38949153 / r38949148;
        double r38949155 = 5.4712057353380415e+122;
        bool r38949156 = r38949149 <= r38949155;
        double r38949157 = r38949152 / r38949149;
        double r38949158 = r38949152 / r38949148;
        double r38949159 = 1.0;
        double r38949160 = r38949159 / r38949146;
        double r38949161 = r38949158 * r38949160;
        double r38949162 = r38949156 ? r38949157 : r38949161;
        double r38949163 = r38949151 ? r38949154 : r38949162;
        return r38949163;
}

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
Herbie1.0
\[\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)) < -inf.0

    1. Initial program 19.3

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt19.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.4

      \[\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/0.4

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

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

    if -inf.0 < (* (- y z) (- t z)) < 5.4712057353380415e+122

    1. Initial program 1.6

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

    if 5.4712057353380415e+122 < (* (- 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 div-inv0.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(t - z\right) \cdot \left(y - z\right) = -\infty:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 5.471205735338041489015307420563816280698 \cdot 10^{122}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y - z} \cdot \frac{1}{t - z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019168 
(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.0 (* (- y z) (- t z)))))

  (/ x (* (- y z) (- t z))))