Average Error: 7.8 → 0.9
Time: 13.3s
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) = -\infty:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le 1.22506240341463963 \cdot 10^{298}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - 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(y - z\right) \cdot \left(t - z\right) = -\infty:\\
\;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\

\mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le 1.22506240341463963 \cdot 10^{298}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - 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 r456214 = x;
        double r456215 = y;
        double r456216 = z;
        double r456217 = r456215 - r456216;
        double r456218 = t;
        double r456219 = r456218 - r456216;
        double r456220 = r456217 * r456219;
        double r456221 = r456214 / r456220;
        return r456221;
}

double f(double x, double y, double z, double t) {
        double r456222 = y;
        double r456223 = z;
        double r456224 = r456222 - r456223;
        double r456225 = t;
        double r456226 = r456225 - r456223;
        double r456227 = r456224 * r456226;
        double r456228 = -inf.0;
        bool r456229 = r456227 <= r456228;
        double r456230 = x;
        double r456231 = r456230 / r456226;
        double r456232 = r456231 / r456224;
        double r456233 = 1.2250624034146396e+298;
        bool r456234 = r456227 <= r456233;
        double r456235 = r456230 / r456227;
        double r456236 = 1.0;
        double r456237 = r456226 / r456230;
        double r456238 = r456236 / r456237;
        double r456239 = r456238 / r456224;
        double r456240 = r456234 ? r456235 : r456239;
        double r456241 = r456229 ? r456232 : r456240;
        return r456241;
}

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.8
Target8.6
Herbie0.9
\[\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.1

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

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

      \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}}\]
    5. Using strategy rm
    6. Applied associate-*l/0.1

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{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)) < 1.2250624034146396e+298

    1. Initial program 1.4

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

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

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

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

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

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

    if 1.2250624034146396e+298 < (* (- y z) (- t z))

    1. Initial program 16.3

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

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

      \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}}\]
    5. Using strategy rm
    6. Applied associate-*l/0.1

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

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

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

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

Reproduce

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