Average Error: 7.1 → 1.1
Time: 3.5s
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:\\ \;\;\;\;1 \cdot \left(\frac{x}{t - z} \cdot \frac{1}{y - z}\right)\\ \mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le -1.173720323052323956659235148309787539083 \cdot 10^{-94}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \frac{\frac{x}{t - z}}{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:\\
\;\;\;\;1 \cdot \left(\frac{x}{t - z} \cdot \frac{1}{y - z}\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r753322 = x;
        double r753323 = y;
        double r753324 = z;
        double r753325 = r753323 - r753324;
        double r753326 = t;
        double r753327 = r753326 - r753324;
        double r753328 = r753325 * r753327;
        double r753329 = r753322 / r753328;
        return r753329;
}

double f(double x, double y, double z, double t) {
        double r753330 = y;
        double r753331 = z;
        double r753332 = r753330 - r753331;
        double r753333 = t;
        double r753334 = r753333 - r753331;
        double r753335 = r753332 * r753334;
        double r753336 = -inf.0;
        bool r753337 = r753335 <= r753336;
        double r753338 = 1.0;
        double r753339 = x;
        double r753340 = r753339 / r753334;
        double r753341 = r753338 / r753332;
        double r753342 = r753340 * r753341;
        double r753343 = r753338 * r753342;
        double r753344 = -1.173720323052324e-94;
        bool r753345 = r753335 <= r753344;
        double r753346 = r753339 / r753335;
        double r753347 = r753340 / r753332;
        double r753348 = r753338 * r753347;
        double r753349 = r753345 ? r753346 : r753348;
        double r753350 = r753337 ? r753343 : r753349;
        return r753350;
}

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.1
Target7.9
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 3 regimes
  2. if (* (- y z) (- t z)) < -inf.0

    1. Initial program 19.0

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

      \[\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 *-un-lft-identity0.1

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{\frac{x}{t - z}}{y - z}}\]
    9. Using strategy rm
    10. Applied div-inv0.1

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

    if -inf.0 < (* (- y z) (- t z)) < -1.173720323052324e-94

    1. Initial program 0.2

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

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

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

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

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

    if -1.173720323052324e-94 < (* (- y z) (- t z))

    1. Initial program 7.5

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

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

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

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

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

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

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

Reproduce

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