Average Error: 7.0 → 1.5
Time: 16.4s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \le 0.0:\\ \;\;\;\;\frac{\frac{1}{\frac{y - z}{x}}}{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}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \le 0.0:\\
\;\;\;\;\frac{\frac{1}{\frac{y - z}{x}}}{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 r495455 = x;
        double r495456 = y;
        double r495457 = z;
        double r495458 = r495456 - r495457;
        double r495459 = t;
        double r495460 = r495459 - r495457;
        double r495461 = r495458 * r495460;
        double r495462 = r495455 / r495461;
        return r495462;
}

double f(double x, double y, double z, double t) {
        double r495463 = x;
        double r495464 = y;
        double r495465 = z;
        double r495466 = r495464 - r495465;
        double r495467 = t;
        double r495468 = r495467 - r495465;
        double r495469 = r495466 * r495468;
        double r495470 = r495463 / r495469;
        double r495471 = 0.0;
        bool r495472 = r495470 <= r495471;
        double r495473 = 1.0;
        double r495474 = r495466 / r495463;
        double r495475 = r495473 / r495474;
        double r495476 = r495475 / r495468;
        double r495477 = r495472 ? r495476 : r495470;
        return r495477;
}

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.0
Target7.8
Herbie1.5
\[\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 (/ x (* (- y z) (- t z))) < 0.0

    1. Initial program 7.2

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

      \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - z}}\]
    4. Using strategy rm
    5. Applied clear-num2.2

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

    if 0.0 < (/ x (* (- y z) (- t z)))

    1. Initial program 6.8

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.5

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

Reproduce

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