Average Error: 7.6 → 2.3
Time: 4.2s
Precision: binary64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;t \leq -2.1355344036848286 \cdot 10^{-139}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{elif}\;t \leq 1.6280989697092715 \cdot 10^{+131}:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(t - z\right) \cdot \frac{y - z}{x}}\\ \end{array}\]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
\mathbf{if}\;t \leq -2.1355344036848286 \cdot 10^{-139}:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\

\mathbf{elif}\;t \leq 1.6280989697092715 \cdot 10^{+131}:\\
\;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(t - z\right) \cdot \frac{y - z}{x}}\\

\end{array}
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 VAR;
	if ((t <= -2.1355344036848286e-139)) {
		VAR = ((x / ((double) (y - z))) / ((double) (t - z)));
	} else {
		double VAR_1;
		if ((t <= 1.6280989697092715e+131)) {
			VAR_1 = ((double) ((1.0 / ((double) (y - z))) * (x / ((double) (t - z)))));
		} else {
			VAR_1 = (1.0 / ((double) (((double) (t - z)) * (((double) (y - z)) / x))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.6
Target8.4
Herbie2.3
\[\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 t < -2.1355344036848286e-139

    1. Initial program 7.4

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

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

    if -2.1355344036848286e-139 < t < 1.628098969709271e131

    1. Initial program 6.7

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

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

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

    if 1.628098969709271e131 < t

    1. Initial program 10.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.1355344036848286 \cdot 10^{-139}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{elif}\;t \leq 1.6280989697092715 \cdot 10^{+131}:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\left(t - z\right) \cdot \frac{y - z}{x}}\\ \end{array}\]

Reproduce

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