Average Error: 6.8 → 0.8
Time: 17.8s
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 \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 1.6269844469489594 \cdot 10^{171}\right):\\ \;\;\;\;\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) = -\infty \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 1.6269844469489594 \cdot 10^{171}\right):\\
\;\;\;\;\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 r569472 = x;
        double r569473 = y;
        double r569474 = z;
        double r569475 = r569473 - r569474;
        double r569476 = t;
        double r569477 = r569476 - r569474;
        double r569478 = r569475 * r569477;
        double r569479 = r569472 / r569478;
        return r569479;
}

double f(double x, double y, double z, double t) {
        double r569480 = y;
        double r569481 = z;
        double r569482 = r569480 - r569481;
        double r569483 = t;
        double r569484 = r569483 - r569481;
        double r569485 = r569482 * r569484;
        double r569486 = -inf.0;
        bool r569487 = r569485 <= r569486;
        double r569488 = 1.6269844469489594e+171;
        bool r569489 = r569485 <= r569488;
        double r569490 = !r569489;
        bool r569491 = r569487 || r569490;
        double r569492 = x;
        double r569493 = r569492 / r569482;
        double r569494 = r569493 / r569484;
        double r569495 = r569492 / r569485;
        double r569496 = r569491 ? r569494 : r569495;
        return r569496;
}

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

Original6.8
Target7.5
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)) < -inf.0 or 1.6269844469489594e+171 < (* (- y z) (- t z))

    1. Initial program 11.6

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

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

    if -inf.0 < (* (- y z) (- t z)) < 1.6269844469489594e+171

    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-frac4.9

      \[\leadsto \color{blue}{\frac{1}{y - z} \cdot \frac{x}{t - z}}\]
    5. Using strategy rm
    6. Applied pow14.9

      \[\leadsto \frac{1}{y - z} \cdot \color{blue}{{\left(\frac{x}{t - z}\right)}^{1}}\]
    7. Applied pow14.9

      \[\leadsto \color{blue}{{\left(\frac{1}{y - z}\right)}^{1}} \cdot {\left(\frac{x}{t - z}\right)}^{1}\]
    8. Applied pow-prod-down4.9

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

      \[\leadsto {\color{blue}{\left(\frac{\frac{x}{t - z}}{y - z}\right)}}^{1}\]
    10. Using strategy rm
    11. Applied div-inv4.9

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

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

      \[\leadsto {\left(\frac{x}{\color{blue}{\left(y - z\right) \cdot \left(t - z\right)}}\right)}^{1}\]
  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) = -\infty \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le 1.6269844469489594 \cdot 10^{171}\right):\\ \;\;\;\;\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 2019198 +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.0 (* (- y z) (- t z)))))

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