Average Error: 7.5 → 2.0
Time: 8.9s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -6.2234270145344795 \cdot 10^{-113}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{elif}\;z \le 5.02895661975026341 \cdot 10^{-230}:\\ \;\;\;\;\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}\;z \le -6.2234270145344795 \cdot 10^{-113}:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\

\mathbf{elif}\;z \le 5.02895661975026341 \cdot 10^{-230}:\\
\;\;\;\;\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 code(double x, double y, double z, double t) {
	return (x / ((y - z) * (t - z)));
}
double code(double x, double y, double z, double t) {
	double temp;
	if ((z <= -6.22342701453448e-113)) {
		temp = ((x / (y - z)) / (t - z));
	} else {
		double temp_1;
		if ((z <= 5.028956619750263e-230)) {
			temp_1 = (x / ((y - z) * (t - z)));
		} else {
			temp_1 = ((1.0 / (y - z)) * (x / (t - z)));
		}
		temp = temp_1;
	}
	return temp;
}

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.5
Target8.2
Herbie2.0
\[\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 z < -6.22342701453448e-113

    1. Initial program 8.8

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

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

    if -6.22342701453448e-113 < z < 5.028956619750263e-230

    1. Initial program 5.4

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]

    if 5.028956619750263e-230 < z

    1. Initial program 7.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -6.2234270145344795 \cdot 10^{-113}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{elif}\;z \le 5.02895661975026341 \cdot 10^{-230}:\\ \;\;\;\;\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 2020049 +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))))