Average Error: 7.2 → 2.0
Time: 3.6s
Precision: binary64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -2.6932216824551583 \cdot 10^{-91}:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\ \mathbf{elif}\;z \leq -8.92551241015119 \cdot 10^{-218}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \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}\;z \leq -2.6932216824551583 \cdot 10^{-91}:\\
\;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\

\mathbf{elif}\;z \leq -8.92551241015119 \cdot 10^{-218}:\\
\;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
(FPCore (x y z t)
 :precision binary64
 (if (<= z -2.6932216824551583e-91)
   (* (/ 1.0 (- y z)) (/ x (- t z)))
   (if (<= z -8.92551241015119e-218)
     (/ x (* (- y z) (- t z)))
     (/ (/ x (- y z)) (- t z)))))
double code(double x, double y, double z, double t) {
	return (x / ((double) (((double) (y - z)) * ((double) (t - z)))));
}
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -2.6932216824551583e-91)) {
		tmp = ((double) ((1.0 / ((double) (y - z))) * (x / ((double) (t - z)))));
	} else {
		double tmp_1;
		if ((z <= -8.92551241015119e-218)) {
			tmp_1 = (x / ((double) (((double) (y - z)) * ((double) (t - z)))));
		} else {
			tmp_1 = ((x / ((double) (y - z))) / ((double) (t - z)));
		}
		tmp = tmp_1;
	}
	return tmp;
}

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.0
\[\begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} < 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 < -2.6932216824551583e-91

    1. Initial program Error: 7.9 bits

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

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

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

    if -2.6932216824551583e-91 < z < -8.9255124101511899e-218

    1. Initial program Error: 3.7 bits

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

    if -8.9255124101511899e-218 < z

    1. Initial program Error: 7.3 bits

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

      \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - z}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplificationError: 2.0 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.6932216824551583 \cdot 10^{-91}:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\ \mathbf{elif}\;z \leq -8.92551241015119 \cdot 10^{-218}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020204 
(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.0 (* (- y z) (- t z)))))

  (/ x (* (- y z) (- t z))))