Average Error: 7.3 → 0.7
Time: 6.7s
Precision: binary64
\[[y, t] = \mathsf{sort}([y, t]) \\]
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
\[\begin{array}{l} t_1 := \left(y - z\right) \cdot \left(t - z\right)\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{elif}\;t_1 \leq 6.4431370762226415 \cdot 10^{+211}:\\ \;\;\;\;\frac{x}{t_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \end{array} \]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \left(t - z\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\

\mathbf{elif}\;t_1 \leq 6.4431370762226415 \cdot 10^{+211}:\\
\;\;\;\;\frac{x}{t_1}\\

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


\end{array}
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (- y z) (- t z))))
   (if (<= t_1 (- INFINITY))
     (/ (/ x (- y z)) (- t z))
     (if (<= t_1 6.4431370762226415e+211)
       (/ x t_1)
       (/ (/ x (- t z)) (- y z))))))
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 t_1 = (y - z) * (t - z);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = (x / (y - z)) / (t - z);
	} else if (t_1 <= 6.4431370762226415e+211) {
		tmp = x / t_1;
	} else {
		tmp = (x / (t - z)) / (y - z);
	}
	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.3
Target8.0
Herbie0.7
\[\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 (*.f64 (-.f64 y z) (-.f64 t z)) < -inf.0

    1. Initial program 21.5

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Applied associate-/r*_binary640.1

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

    if -inf.0 < (*.f64 (-.f64 y z) (-.f64 t z)) < 6.4431370762226415e211

    1. Initial program 1.1

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

    if 6.4431370762226415e211 < (*.f64 (-.f64 y z) (-.f64 t z))

    1. Initial program 12.2

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Applied add-cube-cbrt_binary6412.4

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\left(y - z\right) \cdot \left(t - z\right)} \]
    3. Applied times-frac_binary640.5

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z} \cdot \frac{\sqrt[3]{x}}{t - z}} \]
    4. Applied associate-*l/_binary640.6

      \[\leadsto \color{blue}{\frac{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \frac{\sqrt[3]{x}}{t - z}}{y - z}} \]
    5. Simplified0.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \leq -\infty:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \leq 6.4431370762226415 \cdot 10^{+211}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \end{array} \]

Reproduce

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