Average Error: 7.7 → 1.2
Time: 17.0s
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) \le -0.0:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le 1.651412662944868599208622885663655207487 \cdot 10^{240}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - 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) \le -0.0:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r498038 = x;
        double r498039 = y;
        double r498040 = z;
        double r498041 = r498039 - r498040;
        double r498042 = t;
        double r498043 = r498042 - r498040;
        double r498044 = r498041 * r498043;
        double r498045 = r498038 / r498044;
        return r498045;
}

double f(double x, double y, double z, double t) {
        double r498046 = y;
        double r498047 = z;
        double r498048 = r498046 - r498047;
        double r498049 = t;
        double r498050 = r498049 - r498047;
        double r498051 = r498048 * r498050;
        double r498052 = -0.0;
        bool r498053 = r498051 <= r498052;
        double r498054 = x;
        double r498055 = r498054 / r498048;
        double r498056 = r498055 / r498050;
        double r498057 = 1.6514126629448686e+240;
        bool r498058 = r498051 <= r498057;
        double r498059 = r498054 / r498051;
        double r498060 = 1.0;
        double r498061 = r498060 / r498048;
        double r498062 = r498054 / r498050;
        double r498063 = r498061 * r498062;
        double r498064 = r498058 ? r498059 : r498063;
        double r498065 = r498053 ? r498056 : r498064;
        return r498065;
}

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.7
Target8.6
Herbie1.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 3 regimes
  2. if (* (- y z) (- t z)) < -0.0

    1. Initial program 7.1

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

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

    if -0.0 < (* (- y z) (- t z)) < 1.6514126629448686e+240

    1. Initial program 1.2

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

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

    if 1.6514126629448686e+240 < (* (- y z) (- t z))

    1. Initial program 13.4

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

      \[\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}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.2

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

Reproduce

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