Average Error: 0.6 → 0.3
Time: 2.8s
Precision: 64
\[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.1853581668252757 \cdot 10^{92}:\\ \;\;\;\;1 - x \cdot \frac{1}{\left(y - z\right) \cdot \left(y - t\right)}\\ \mathbf{elif}\;x \le 5.61170751794338 \cdot 10^{244}:\\ \;\;\;\;1 - \frac{\frac{x}{y - t}}{y - z}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{1}{\frac{\left(y - z\right) \cdot \left(y - t\right)}{x}}\\ \end{array}\]
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\begin{array}{l}
\mathbf{if}\;x \le -3.1853581668252757 \cdot 10^{92}:\\
\;\;\;\;1 - x \cdot \frac{1}{\left(y - z\right) \cdot \left(y - t\right)}\\

\mathbf{elif}\;x \le 5.61170751794338 \cdot 10^{244}:\\
\;\;\;\;1 - \frac{\frac{x}{y - t}}{y - z}\\

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

\end{array}
double code(double x, double y, double z, double t) {
	return (1.0 - (x / ((y - z) * (y - t))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((x <= -3.1853581668252757e+92)) {
		VAR = (1.0 - (x * (1.0 / ((y - z) * (y - t)))));
	} else {
		double VAR_1;
		if ((x <= 5.611707517943382e+244)) {
			VAR_1 = (1.0 - ((x / (y - t)) / (y - z)));
		} else {
			VAR_1 = (1.0 - (1.0 / (((y - z) * (y - t)) / 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

Derivation

  1. Split input into 3 regimes
  2. if x < -3.1853581668252757e+92

    1. Initial program 0.1

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

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

    if -3.1853581668252757e+92 < x < 5.611707517943382e+244

    1. Initial program 0.8

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

      \[\leadsto 1 - \color{blue}{x \cdot \frac{1}{\left(y - z\right) \cdot \left(y - t\right)}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity0.9

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{x}{y - z}} \cdot \frac{1}{y - t}\]
    9. Using strategy rm
    10. Applied associate-*l/0.4

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

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

    if 5.611707517943382e+244 < x

    1. Initial program 0.2

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

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

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

Reproduce

herbie shell --seed 2020092 +o rules:numerics
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A"
  :precision binary64
  (- 1 (/ x (* (- y z) (- y t)))))