Average Error: 7.4 → 0.8
Time: 18.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) \le -2.662328915164341898123574395745294048332 \cdot 10^{305}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 2.614115187290300143140783202507109207474 \cdot 10^{192}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\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(t - z\right) \cdot \left(y - z\right) \le -2.662328915164341898123574395745294048332 \cdot 10^{305}:\\
\;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r33912516 = x;
        double r33912517 = y;
        double r33912518 = z;
        double r33912519 = r33912517 - r33912518;
        double r33912520 = t;
        double r33912521 = r33912520 - r33912518;
        double r33912522 = r33912519 * r33912521;
        double r33912523 = r33912516 / r33912522;
        return r33912523;
}

double f(double x, double y, double z, double t) {
        double r33912524 = t;
        double r33912525 = z;
        double r33912526 = r33912524 - r33912525;
        double r33912527 = y;
        double r33912528 = r33912527 - r33912525;
        double r33912529 = r33912526 * r33912528;
        double r33912530 = -2.662328915164342e+305;
        bool r33912531 = r33912529 <= r33912530;
        double r33912532 = x;
        double r33912533 = r33912532 / r33912526;
        double r33912534 = r33912533 / r33912528;
        double r33912535 = 2.6141151872903e+192;
        bool r33912536 = r33912529 <= r33912535;
        double r33912537 = r33912532 / r33912529;
        double r33912538 = r33912536 ? r33912537 : r33912534;
        double r33912539 = r33912531 ? r33912534 : r33912538;
        return r33912539;
}

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.4
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)) < -2.662328915164342e+305 or 2.6141151872903e+192 < (* (- y z) (- t z))

    1. Initial program 13.1

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

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

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

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

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

    if -2.662328915164342e+305 < (* (- y z) (- t z)) < 2.6141151872903e+192

    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.1

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

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

      \[\leadsto \frac{\color{blue}{x}}{\left(y - z\right) \cdot \left(t - z\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(t - z\right) \cdot \left(y - z\right) \le -2.662328915164341898123574395745294048332 \cdot 10^{305}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \mathbf{elif}\;\left(t - z\right) \cdot \left(y - z\right) \le 2.614115187290300143140783202507109207474 \cdot 10^{192}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \end{array}\]

Reproduce

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