Average Error: 6.8 → 2.4
Time: 15.6s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.4924552858041998 \cdot 10^{206} \lor \neg \left(x \le 1.803066795734152 \cdot 10^{136}\right):\\ \;\;\;\;\frac{1}{\frac{y - z}{\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 -2.4924552858041998 \cdot 10^{206} \lor \neg \left(x \le 1.803066795734152 \cdot 10^{136}\right):\\
\;\;\;\;\frac{1}{\frac{y - z}{\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 r580781 = x;
        double r580782 = y;
        double r580783 = z;
        double r580784 = r580782 - r580783;
        double r580785 = t;
        double r580786 = r580785 - r580783;
        double r580787 = r580784 * r580786;
        double r580788 = r580781 / r580787;
        return r580788;
}

double f(double x, double y, double z, double t) {
        double r580789 = x;
        double r580790 = -2.4924552858041998e+206;
        bool r580791 = r580789 <= r580790;
        double r580792 = 1.803066795734152e+136;
        bool r580793 = r580789 <= r580792;
        double r580794 = !r580793;
        bool r580795 = r580791 || r580794;
        double r580796 = 1.0;
        double r580797 = y;
        double r580798 = z;
        double r580799 = r580797 - r580798;
        double r580800 = t;
        double r580801 = r580800 - r580798;
        double r580802 = r580789 / r580801;
        double r580803 = r580799 / r580802;
        double r580804 = r580796 / r580803;
        double r580805 = r580789 / r580799;
        double r580806 = r580805 / r580801;
        double r580807 = r580795 ? r580804 : r580806;
        return r580807;
}

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

Original6.8
Target7.5
Herbie2.4
\[\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 < -2.4924552858041998e+206 or 1.803066795734152e+136 < x

    1. Initial program 20.6

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

      \[\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 *-un-lft-identity5.4

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{\frac{x}{t - z}}{y - z}}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity5.3

      \[\leadsto 1 \cdot \frac{\frac{x}{\color{blue}{1 \cdot \left(t - z\right)}}}{y - z}\]
    11. Applied *-un-lft-identity5.3

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

      \[\leadsto 1 \cdot \frac{\color{blue}{\frac{1}{1} \cdot \frac{x}{t - z}}}{y - z}\]
    13. Applied associate-/l*5.8

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

    if -2.4924552858041998e+206 < x < 1.803066795734152e+136

    1. Initial program 3.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -2.4924552858041998 \cdot 10^{206} \lor \neg \left(x \le 1.803066795734152 \cdot 10^{136}\right):\\ \;\;\;\;\frac{1}{\frac{y - z}{\frac{x}{t - z}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \end{array}\]

Reproduce

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