Average Error: 7.2 → 2.2
Time: 5.1s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le 7.80787067859947528468579780877559401605 \cdot 10^{151}:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \end{array}\]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
\mathbf{if}\;x \le 7.80787067859947528468579780877559401605 \cdot 10^{151}:\\
\;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r352822 = x;
        double r352823 = y;
        double r352824 = z;
        double r352825 = r352823 - r352824;
        double r352826 = t;
        double r352827 = r352826 - r352824;
        double r352828 = r352825 * r352827;
        double r352829 = r352822 / r352828;
        return r352829;
}

double f(double x, double y, double z, double t) {
        double r352830 = x;
        double r352831 = 7.807870678599475e+151;
        bool r352832 = r352830 <= r352831;
        double r352833 = 1.0;
        double r352834 = y;
        double r352835 = z;
        double r352836 = r352834 - r352835;
        double r352837 = r352833 / r352836;
        double r352838 = t;
        double r352839 = r352838 - r352835;
        double r352840 = r352830 / r352839;
        double r352841 = r352837 * r352840;
        double r352842 = r352830 / r352836;
        double r352843 = r352842 / r352839;
        double r352844 = r352832 ? r352841 : r352843;
        return r352844;
}

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.2
Target8.0
Herbie2.2
\[\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 < 7.807870678599475e+151

    1. Initial program 5.6

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

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

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

    if 7.807870678599475e+151 < x

    1. Initial program 20.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 7.80787067859947528468579780877559401605 \cdot 10^{151}:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \end{array}\]

Reproduce

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