Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A

Percentage Accurate: 99.2% → 99.2%
Time: 9.9s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \end{array} \]
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
	return 1.0 - (x / ((y - z) * (y - t)));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = 1.0d0 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
	return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t):
	return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t)
	return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t))))
end
function tmp = code(x, y, z, t)
	tmp = 1.0 - (x / ((y - z) * (y - t)));
end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \end{array} \]
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
double code(double x, double y, double z, double t) {
	return 1.0 - (x / ((y - z) * (y - t)));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = 1.0d0 - (x / ((y - z) * (y - t)))
end function
public static double code(double x, double y, double z, double t) {
	return 1.0 - (x / ((y - z) * (y - t)));
}
def code(x, y, z, t):
	return 1.0 - (x / ((y - z) * (y - t)))
function code(x, y, z, t)
	return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t))))
end
function tmp = code(x, y, z, t)
	tmp = 1.0 - (x / ((y - z) * (y - t)));
end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\end{array}

Alternative 1: 99.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)} \end{array} \]
(FPCore (x y z t) :precision binary64 (+ 1.0 (/ x (* (- y z) (- t y)))))
double code(double x, double y, double z, double t) {
	return 1.0 + (x / ((y - z) * (t - y)));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = 1.0d0 + (x / ((y - z) * (t - y)))
end function
public static double code(double x, double y, double z, double t) {
	return 1.0 + (x / ((y - z) * (t - y)));
}
def code(x, y, z, t):
	return 1.0 + (x / ((y - z) * (t - y)))
function code(x, y, z, t)
	return Float64(1.0 + Float64(x / Float64(Float64(y - z) * Float64(t - y))))
end
function tmp = code(x, y, z, t)
	tmp = 1.0 + (x / ((y - z) * (t - y)));
end
code[x_, y_, z_, t_] := N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)}
\end{array}
Derivation
  1. Initial program 99.2%

    \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
  2. Add Preprocessing
  3. Final simplification99.2%

    \[\leadsto 1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)} \]
  4. Add Preprocessing

Alternative 2: 90.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := 1 + \frac{x}{z \cdot \left(y - t\right)}\\ t_2 := 1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)}\\ \mathbf{if}\;t\_2 \leq -2:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 1.1:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ 1.0 (/ x (* z (- y t)))))
        (t_2 (+ 1.0 (/ x (* (- y z) (- t y))))))
   (if (<= t_2 -2.0) t_1 (if (<= t_2 1.1) 1.0 t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = 1.0 + (x / (z * (y - t)));
	double t_2 = 1.0 + (x / ((y - z) * (t - y)));
	double tmp;
	if (t_2 <= -2.0) {
		tmp = t_1;
	} else if (t_2 <= 1.1) {
		tmp = 1.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = 1.0d0 + (x / (z * (y - t)))
    t_2 = 1.0d0 + (x / ((y - z) * (t - y)))
    if (t_2 <= (-2.0d0)) then
        tmp = t_1
    else if (t_2 <= 1.1d0) then
        tmp = 1.0d0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = 1.0 + (x / (z * (y - t)));
	double t_2 = 1.0 + (x / ((y - z) * (t - y)));
	double tmp;
	if (t_2 <= -2.0) {
		tmp = t_1;
	} else if (t_2 <= 1.1) {
		tmp = 1.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = 1.0 + (x / (z * (y - t)))
	t_2 = 1.0 + (x / ((y - z) * (t - y)))
	tmp = 0
	if t_2 <= -2.0:
		tmp = t_1
	elif t_2 <= 1.1:
		tmp = 1.0
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(1.0 + Float64(x / Float64(z * Float64(y - t))))
	t_2 = Float64(1.0 + Float64(x / Float64(Float64(y - z) * Float64(t - y))))
	tmp = 0.0
	if (t_2 <= -2.0)
		tmp = t_1;
	elseif (t_2 <= 1.1)
		tmp = 1.0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = 1.0 + (x / (z * (y - t)));
	t_2 = 1.0 + (x / ((y - z) * (t - y)));
	tmp = 0.0;
	if (t_2 <= -2.0)
		tmp = t_1;
	elseif (t_2 <= 1.1)
		tmp = 1.0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 + N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2.0], t$95$1, If[LessEqual[t$95$2, 1.1], 1.0, t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := 1 + \frac{x}{z \cdot \left(y - t\right)}\\
t_2 := 1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)}\\
\mathbf{if}\;t\_2 \leq -2:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 1.1:\\
\;\;\;\;1\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -2 or 1.1000000000000001 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))))

    1. Initial program 96.9%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto 1 - \color{blue}{-1 \cdot \frac{x}{z \cdot \left(y - t\right)}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto 1 - \color{blue}{\left(\mathsf{neg}\left(\frac{x}{z \cdot \left(y - t\right)}\right)\right)} \]
      2. distribute-neg-frac2N/A

        \[\leadsto 1 - \color{blue}{\frac{x}{\mathsf{neg}\left(z \cdot \left(y - t\right)\right)}} \]
      3. mul-1-negN/A

        \[\leadsto 1 - \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - t\right)\right)}} \]
      4. lower-/.f64N/A

        \[\leadsto 1 - \color{blue}{\frac{x}{-1 \cdot \left(z \cdot \left(y - t\right)\right)}} \]
      5. mul-1-negN/A

        \[\leadsto 1 - \frac{x}{\color{blue}{\mathsf{neg}\left(z \cdot \left(y - t\right)\right)}} \]
      6. distribute-rgt-neg-inN/A

        \[\leadsto 1 - \frac{x}{\color{blue}{z \cdot \left(\mathsf{neg}\left(\left(y - t\right)\right)\right)}} \]
      7. mul-1-negN/A

        \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(-1 \cdot \left(y - t\right)\right)}} \]
      8. lower-*.f64N/A

        \[\leadsto 1 - \frac{x}{\color{blue}{z \cdot \left(-1 \cdot \left(y - t\right)\right)}} \]
      9. mul-1-negN/A

        \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - t\right)\right)\right)}} \]
      10. sub-negN/A

        \[\leadsto 1 - \frac{x}{z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(t\right)\right)\right)}\right)\right)} \]
      11. mul-1-negN/A

        \[\leadsto 1 - \frac{x}{z \cdot \left(\mathsf{neg}\left(\left(y + \color{blue}{-1 \cdot t}\right)\right)\right)} \]
      12. +-commutativeN/A

        \[\leadsto 1 - \frac{x}{z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(-1 \cdot t + y\right)}\right)\right)} \]
      13. distribute-neg-inN/A

        \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(-1 \cdot t\right)\right) + \left(\mathsf{neg}\left(y\right)\right)\right)}} \]
      14. unsub-negN/A

        \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(-1 \cdot t\right)\right) - y\right)}} \]
      15. mul-1-negN/A

        \[\leadsto 1 - \frac{x}{z \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(t\right)\right)}\right)\right) - y\right)} \]
      16. remove-double-negN/A

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

        \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(t - y\right)}} \]
    5. Applied rewrites71.9%

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

    if -2 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 1.1000000000000001

    1. Initial program 100.0%

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{1} \]
    4. Step-by-step derivation
      1. Applied rewrites99.9%

        \[\leadsto \color{blue}{1} \]
    5. Recombined 2 regimes into one program.
    6. Final simplification92.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)} \leq -2:\\ \;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\ \mathbf{elif}\;1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)} \leq 1.1:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{x}{z \cdot \left(y - t\right)}\\ \end{array} \]
    7. Add Preprocessing

    Alternative 3: 89.9% accurate, 0.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{z \cdot \left(y - t\right)}\\ t_2 := 1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)}\\ \mathbf{if}\;t\_2 \leq -2:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 500:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (let* ((t_1 (/ x (* z (- y t)))) (t_2 (+ 1.0 (/ x (* (- y z) (- t y))))))
       (if (<= t_2 -2.0) t_1 (if (<= t_2 500.0) 1.0 t_1))))
    double code(double x, double y, double z, double t) {
    	double t_1 = x / (z * (y - t));
    	double t_2 = 1.0 + (x / ((y - z) * (t - y)));
    	double tmp;
    	if (t_2 <= -2.0) {
    		tmp = t_1;
    	} else if (t_2 <= 500.0) {
    		tmp = 1.0;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z, t)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        real(8) :: t_1
        real(8) :: t_2
        real(8) :: tmp
        t_1 = x / (z * (y - t))
        t_2 = 1.0d0 + (x / ((y - z) * (t - y)))
        if (t_2 <= (-2.0d0)) then
            tmp = t_1
        else if (t_2 <= 500.0d0) then
            tmp = 1.0d0
        else
            tmp = t_1
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t) {
    	double t_1 = x / (z * (y - t));
    	double t_2 = 1.0 + (x / ((y - z) * (t - y)));
    	double tmp;
    	if (t_2 <= -2.0) {
    		tmp = t_1;
    	} else if (t_2 <= 500.0) {
    		tmp = 1.0;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t):
    	t_1 = x / (z * (y - t))
    	t_2 = 1.0 + (x / ((y - z) * (t - y)))
    	tmp = 0
    	if t_2 <= -2.0:
    		tmp = t_1
    	elif t_2 <= 500.0:
    		tmp = 1.0
    	else:
    		tmp = t_1
    	return tmp
    
    function code(x, y, z, t)
    	t_1 = Float64(x / Float64(z * Float64(y - t)))
    	t_2 = Float64(1.0 + Float64(x / Float64(Float64(y - z) * Float64(t - y))))
    	tmp = 0.0
    	if (t_2 <= -2.0)
    		tmp = t_1;
    	elseif (t_2 <= 500.0)
    		tmp = 1.0;
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t)
    	t_1 = x / (z * (y - t));
    	t_2 = 1.0 + (x / ((y - z) * (t - y)));
    	tmp = 0.0;
    	if (t_2 <= -2.0)
    		tmp = t_1;
    	elseif (t_2 <= 500.0)
    		tmp = 1.0;
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2.0], t$95$1, If[LessEqual[t$95$2, 500.0], 1.0, t$95$1]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \frac{x}{z \cdot \left(y - t\right)}\\
    t_2 := 1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)}\\
    \mathbf{if}\;t\_2 \leq -2:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;t\_2 \leq 500:\\
    \;\;\;\;1\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -2 or 500 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))))

      1. Initial program 96.7%

        \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in z around inf

        \[\leadsto 1 - \color{blue}{-1 \cdot \frac{x}{z \cdot \left(y - t\right)}} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto 1 - \color{blue}{\left(\mathsf{neg}\left(\frac{x}{z \cdot \left(y - t\right)}\right)\right)} \]
        2. distribute-neg-frac2N/A

          \[\leadsto 1 - \color{blue}{\frac{x}{\mathsf{neg}\left(z \cdot \left(y - t\right)\right)}} \]
        3. mul-1-negN/A

          \[\leadsto 1 - \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - t\right)\right)}} \]
        4. lower-/.f64N/A

          \[\leadsto 1 - \color{blue}{\frac{x}{-1 \cdot \left(z \cdot \left(y - t\right)\right)}} \]
        5. mul-1-negN/A

          \[\leadsto 1 - \frac{x}{\color{blue}{\mathsf{neg}\left(z \cdot \left(y - t\right)\right)}} \]
        6. distribute-rgt-neg-inN/A

          \[\leadsto 1 - \frac{x}{\color{blue}{z \cdot \left(\mathsf{neg}\left(\left(y - t\right)\right)\right)}} \]
        7. mul-1-negN/A

          \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(-1 \cdot \left(y - t\right)\right)}} \]
        8. lower-*.f64N/A

          \[\leadsto 1 - \frac{x}{\color{blue}{z \cdot \left(-1 \cdot \left(y - t\right)\right)}} \]
        9. mul-1-negN/A

          \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - t\right)\right)\right)}} \]
        10. sub-negN/A

          \[\leadsto 1 - \frac{x}{z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(t\right)\right)\right)}\right)\right)} \]
        11. mul-1-negN/A

          \[\leadsto 1 - \frac{x}{z \cdot \left(\mathsf{neg}\left(\left(y + \color{blue}{-1 \cdot t}\right)\right)\right)} \]
        12. +-commutativeN/A

          \[\leadsto 1 - \frac{x}{z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(-1 \cdot t + y\right)}\right)\right)} \]
        13. distribute-neg-inN/A

          \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(-1 \cdot t\right)\right) + \left(\mathsf{neg}\left(y\right)\right)\right)}} \]
        14. unsub-negN/A

          \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(-1 \cdot t\right)\right) - y\right)}} \]
        15. mul-1-negN/A

          \[\leadsto 1 - \frac{x}{z \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(t\right)\right)}\right)\right) - y\right)} \]
        16. remove-double-negN/A

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

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

        \[\leadsto 1 - \color{blue}{\frac{x}{z \cdot \left(t - y\right)}} \]
      6. Taylor expanded in x around inf

        \[\leadsto \color{blue}{-1 \cdot \frac{x}{z \cdot \left(t - y\right)}} \]
      7. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \color{blue}{\frac{-1 \cdot x}{z \cdot \left(t - y\right)}} \]
        2. mul-1-negN/A

          \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{z \cdot \left(t - y\right)} \]
        3. sub-negN/A

          \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \color{blue}{\left(t + \left(\mathsf{neg}\left(y\right)\right)\right)}} \]
        4. mul-1-negN/A

          \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \left(t + \color{blue}{-1 \cdot y}\right)} \]
        5. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{z \cdot \left(t + -1 \cdot y\right)}} \]
        6. lower-neg.f64N/A

          \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{z \cdot \left(t + -1 \cdot y\right)} \]
        7. lower-*.f64N/A

          \[\leadsto \frac{\mathsf{neg}\left(x\right)}{\color{blue}{z \cdot \left(t + -1 \cdot y\right)}} \]
        8. mul-1-negN/A

          \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \left(t + \color{blue}{\left(\mathsf{neg}\left(y\right)\right)}\right)} \]
        9. sub-negN/A

          \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \color{blue}{\left(t - y\right)}} \]
        10. lower--.f6469.1

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

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

      if -2 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 500

      1. Initial program 100.0%

        \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \color{blue}{1} \]
      4. Step-by-step derivation
        1. Applied rewrites98.7%

          \[\leadsto \color{blue}{1} \]
      5. Recombined 2 regimes into one program.
      6. Final simplification91.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)} \leq -2:\\ \;\;\;\;\frac{x}{z \cdot \left(y - t\right)}\\ \mathbf{elif}\;1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)} \leq 500:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z \cdot \left(y - t\right)}\\ \end{array} \]
      7. Add Preprocessing

      Alternative 4: 80.8% accurate, 0.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y \cdot z}\\ t_2 := 1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)}\\ \mathbf{if}\;t\_2 \leq -4 \cdot 10^{+44}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 500:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (let* ((t_1 (/ x (* y z))) (t_2 (+ 1.0 (/ x (* (- y z) (- t y))))))
         (if (<= t_2 -4e+44) t_1 (if (<= t_2 500.0) 1.0 t_1))))
      double code(double x, double y, double z, double t) {
      	double t_1 = x / (y * z);
      	double t_2 = 1.0 + (x / ((y - z) * (t - y)));
      	double tmp;
      	if (t_2 <= -4e+44) {
      		tmp = t_1;
      	} else if (t_2 <= 500.0) {
      		tmp = 1.0;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      real(8) function code(x, y, z, t)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8), intent (in) :: t
          real(8) :: t_1
          real(8) :: t_2
          real(8) :: tmp
          t_1 = x / (y * z)
          t_2 = 1.0d0 + (x / ((y - z) * (t - y)))
          if (t_2 <= (-4d+44)) then
              tmp = t_1
          else if (t_2 <= 500.0d0) then
              tmp = 1.0d0
          else
              tmp = t_1
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z, double t) {
      	double t_1 = x / (y * z);
      	double t_2 = 1.0 + (x / ((y - z) * (t - y)));
      	double tmp;
      	if (t_2 <= -4e+44) {
      		tmp = t_1;
      	} else if (t_2 <= 500.0) {
      		tmp = 1.0;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      def code(x, y, z, t):
      	t_1 = x / (y * z)
      	t_2 = 1.0 + (x / ((y - z) * (t - y)))
      	tmp = 0
      	if t_2 <= -4e+44:
      		tmp = t_1
      	elif t_2 <= 500.0:
      		tmp = 1.0
      	else:
      		tmp = t_1
      	return tmp
      
      function code(x, y, z, t)
      	t_1 = Float64(x / Float64(y * z))
      	t_2 = Float64(1.0 + Float64(x / Float64(Float64(y - z) * Float64(t - y))))
      	tmp = 0.0
      	if (t_2 <= -4e+44)
      		tmp = t_1;
      	elseif (t_2 <= 500.0)
      		tmp = 1.0;
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z, t)
      	t_1 = x / (y * z);
      	t_2 = 1.0 + (x / ((y - z) * (t - y)));
      	tmp = 0.0;
      	if (t_2 <= -4e+44)
      		tmp = t_1;
      	elseif (t_2 <= 500.0)
      		tmp = 1.0;
      	else
      		tmp = t_1;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+44], t$95$1, If[LessEqual[t$95$2, 500.0], 1.0, t$95$1]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \frac{x}{y \cdot z}\\
      t_2 := 1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)}\\
      \mathbf{if}\;t\_2 \leq -4 \cdot 10^{+44}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;t\_2 \leq 500:\\
      \;\;\;\;1\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -4.0000000000000004e44 or 500 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))))

        1. Initial program 96.4%

          \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in z around inf

          \[\leadsto 1 - \color{blue}{-1 \cdot \frac{x}{z \cdot \left(y - t\right)}} \]
        4. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto 1 - \color{blue}{\left(\mathsf{neg}\left(\frac{x}{z \cdot \left(y - t\right)}\right)\right)} \]
          2. distribute-neg-frac2N/A

            \[\leadsto 1 - \color{blue}{\frac{x}{\mathsf{neg}\left(z \cdot \left(y - t\right)\right)}} \]
          3. mul-1-negN/A

            \[\leadsto 1 - \frac{x}{\color{blue}{-1 \cdot \left(z \cdot \left(y - t\right)\right)}} \]
          4. lower-/.f64N/A

            \[\leadsto 1 - \color{blue}{\frac{x}{-1 \cdot \left(z \cdot \left(y - t\right)\right)}} \]
          5. mul-1-negN/A

            \[\leadsto 1 - \frac{x}{\color{blue}{\mathsf{neg}\left(z \cdot \left(y - t\right)\right)}} \]
          6. distribute-rgt-neg-inN/A

            \[\leadsto 1 - \frac{x}{\color{blue}{z \cdot \left(\mathsf{neg}\left(\left(y - t\right)\right)\right)}} \]
          7. mul-1-negN/A

            \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(-1 \cdot \left(y - t\right)\right)}} \]
          8. lower-*.f64N/A

            \[\leadsto 1 - \frac{x}{\color{blue}{z \cdot \left(-1 \cdot \left(y - t\right)\right)}} \]
          9. mul-1-negN/A

            \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(y - t\right)\right)\right)}} \]
          10. sub-negN/A

            \[\leadsto 1 - \frac{x}{z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(t\right)\right)\right)}\right)\right)} \]
          11. mul-1-negN/A

            \[\leadsto 1 - \frac{x}{z \cdot \left(\mathsf{neg}\left(\left(y + \color{blue}{-1 \cdot t}\right)\right)\right)} \]
          12. +-commutativeN/A

            \[\leadsto 1 - \frac{x}{z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(-1 \cdot t + y\right)}\right)\right)} \]
          13. distribute-neg-inN/A

            \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(-1 \cdot t\right)\right) + \left(\mathsf{neg}\left(y\right)\right)\right)}} \]
          14. unsub-negN/A

            \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(-1 \cdot t\right)\right) - y\right)}} \]
          15. mul-1-negN/A

            \[\leadsto 1 - \frac{x}{z \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(t\right)\right)}\right)\right) - y\right)} \]
          16. remove-double-negN/A

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

            \[\leadsto 1 - \frac{x}{z \cdot \color{blue}{\left(t - y\right)}} \]
        5. Applied rewrites68.0%

          \[\leadsto 1 - \color{blue}{\frac{x}{z \cdot \left(t - y\right)}} \]
        6. Taylor expanded in x around inf

          \[\leadsto \color{blue}{-1 \cdot \frac{x}{z \cdot \left(t - y\right)}} \]
        7. Step-by-step derivation
          1. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{-1 \cdot x}{z \cdot \left(t - y\right)}} \]
          2. mul-1-negN/A

            \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{z \cdot \left(t - y\right)} \]
          3. sub-negN/A

            \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \color{blue}{\left(t + \left(\mathsf{neg}\left(y\right)\right)\right)}} \]
          4. mul-1-negN/A

            \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \left(t + \color{blue}{-1 \cdot y}\right)} \]
          5. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(x\right)}{z \cdot \left(t + -1 \cdot y\right)}} \]
          6. lower-neg.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{z \cdot \left(t + -1 \cdot y\right)} \]
          7. lower-*.f64N/A

            \[\leadsto \frac{\mathsf{neg}\left(x\right)}{\color{blue}{z \cdot \left(t + -1 \cdot y\right)}} \]
          8. mul-1-negN/A

            \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \left(t + \color{blue}{\left(\mathsf{neg}\left(y\right)\right)}\right)} \]
          9. sub-negN/A

            \[\leadsto \frac{\mathsf{neg}\left(x\right)}{z \cdot \color{blue}{\left(t - y\right)}} \]
          10. lower--.f6468.0

            \[\leadsto \frac{-x}{z \cdot \color{blue}{\left(t - y\right)}} \]
        8. Applied rewrites68.0%

          \[\leadsto \color{blue}{\frac{-x}{z \cdot \left(t - y\right)}} \]
        9. Taylor expanded in t around 0

          \[\leadsto \color{blue}{\frac{x}{y \cdot z}} \]
        10. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x}{y \cdot z}} \]
          2. lower-*.f6430.6

            \[\leadsto \frac{x}{\color{blue}{y \cdot z}} \]
        11. Applied rewrites30.6%

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

        if -4.0000000000000004e44 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 500

        1. Initial program 100.0%

          \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \color{blue}{1} \]
        4. Step-by-step derivation
          1. Applied rewrites96.2%

            \[\leadsto \color{blue}{1} \]
        5. Recombined 2 regimes into one program.
        6. Final simplification81.6%

          \[\leadsto \begin{array}{l} \mathbf{if}\;1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)} \leq -4 \cdot 10^{+44}:\\ \;\;\;\;\frac{x}{y \cdot z}\\ \mathbf{elif}\;1 + \frac{x}{\left(y - z\right) \cdot \left(t - y\right)} \leq 500:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot z}\\ \end{array} \]
        7. Add Preprocessing

        Alternative 5: 89.0% accurate, 0.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\ t_2 := \frac{x}{\left(y - z\right) \cdot t}\\ \mathbf{if}\;t\_1 \leq -400:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-13}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (let* ((t_1 (/ x (* (- y z) (- y t)))) (t_2 (/ x (* (- y z) t))))
           (if (<= t_1 -400.0) t_2 (if (<= t_1 4e-13) 1.0 t_2))))
        double code(double x, double y, double z, double t) {
        	double t_1 = x / ((y - z) * (y - t));
        	double t_2 = x / ((y - z) * t);
        	double tmp;
        	if (t_1 <= -400.0) {
        		tmp = t_2;
        	} else if (t_1 <= 4e-13) {
        		tmp = 1.0;
        	} else {
        		tmp = t_2;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z, t)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8), intent (in) :: t
            real(8) :: t_1
            real(8) :: t_2
            real(8) :: tmp
            t_1 = x / ((y - z) * (y - t))
            t_2 = x / ((y - z) * t)
            if (t_1 <= (-400.0d0)) then
                tmp = t_2
            else if (t_1 <= 4d-13) then
                tmp = 1.0d0
            else
                tmp = t_2
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z, double t) {
        	double t_1 = x / ((y - z) * (y - t));
        	double t_2 = x / ((y - z) * t);
        	double tmp;
        	if (t_1 <= -400.0) {
        		tmp = t_2;
        	} else if (t_1 <= 4e-13) {
        		tmp = 1.0;
        	} else {
        		tmp = t_2;
        	}
        	return tmp;
        }
        
        def code(x, y, z, t):
        	t_1 = x / ((y - z) * (y - t))
        	t_2 = x / ((y - z) * t)
        	tmp = 0
        	if t_1 <= -400.0:
        		tmp = t_2
        	elif t_1 <= 4e-13:
        		tmp = 1.0
        	else:
        		tmp = t_2
        	return tmp
        
        function code(x, y, z, t)
        	t_1 = Float64(x / Float64(Float64(y - z) * Float64(y - t)))
        	t_2 = Float64(x / Float64(Float64(y - z) * t))
        	tmp = 0.0
        	if (t_1 <= -400.0)
        		tmp = t_2;
        	elseif (t_1 <= 4e-13)
        		tmp = 1.0;
        	else
        		tmp = t_2;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z, t)
        	t_1 = x / ((y - z) * (y - t));
        	t_2 = x / ((y - z) * t);
        	tmp = 0.0;
        	if (t_1 <= -400.0)
        		tmp = t_2;
        	elseif (t_1 <= 4e-13)
        		tmp = 1.0;
        	else
        		tmp = t_2;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -400.0], t$95$2, If[LessEqual[t$95$1, 4e-13], 1.0, t$95$2]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
        t_2 := \frac{x}{\left(y - z\right) \cdot t}\\
        \mathbf{if}\;t\_1 \leq -400:\\
        \;\;\;\;t\_2\\
        
        \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-13}:\\
        \;\;\;\;1\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_2\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < -400 or 4.0000000000000001e-13 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))

          1. Initial program 96.8%

            \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto 1 - \frac{x}{\color{blue}{\left(y - z\right)} \cdot \left(y - t\right)} \]
            2. lift--.f64N/A

              \[\leadsto 1 - \frac{x}{\left(y - z\right) \cdot \color{blue}{\left(y - t\right)}} \]
            3. lift-*.f64N/A

              \[\leadsto 1 - \frac{x}{\color{blue}{\left(y - z\right) \cdot \left(y - t\right)}} \]
            4. lift-/.f64N/A

              \[\leadsto 1 - \color{blue}{\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
            5. *-lft-identityN/A

              \[\leadsto 1 - \color{blue}{1 \cdot \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
            6. cancel-sign-sub-invN/A

              \[\leadsto \color{blue}{1 + \left(\mathsf{neg}\left(1\right)\right) \cdot \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}} \]
            7. metadata-evalN/A

              \[\leadsto 1 + \color{blue}{-1} \cdot \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
            8. neg-mul-1N/A

              \[\leadsto 1 + \color{blue}{\left(\mathsf{neg}\left(\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)\right)} \]
            9. +-commutativeN/A

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\right)\right) + 1} \]
            10. lift-/.f64N/A

              \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{x}{\left(y - z\right) \cdot \left(y - t\right)}}\right)\right) + 1 \]
            11. clear-numN/A

              \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{1}{\frac{\left(y - z\right) \cdot \left(y - t\right)}{x}}}\right)\right) + 1 \]
            12. associate-/r/N/A

              \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{1}{\left(y - z\right) \cdot \left(y - t\right)} \cdot x}\right)\right) + 1 \]
            13. distribute-lft-neg-inN/A

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{\left(y - z\right) \cdot \left(y - t\right)}\right)\right) \cdot x} + 1 \]
            14. distribute-frac-neg2N/A

              \[\leadsto \color{blue}{\frac{1}{\mathsf{neg}\left(\left(y - z\right) \cdot \left(y - t\right)\right)}} \cdot x + 1 \]
            15. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\mathsf{neg}\left(\left(y - z\right) \cdot \left(y - t\right)\right)}, x, 1\right)} \]
          4. Applied rewrites96.6%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-1}{\left(y - z\right) \cdot \left(y - t\right)}, x, 1\right)} \]
          5. Taylor expanded in t around inf

            \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{t \cdot \left(y - z\right)}}, x, 1\right) \]
          6. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{t \cdot \left(y - z\right)}}, x, 1\right) \]
            2. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{1}{\color{blue}{t \cdot \left(y - z\right)}}, x, 1\right) \]
            3. lower--.f6464.7

              \[\leadsto \mathsf{fma}\left(\frac{1}{t \cdot \color{blue}{\left(y - z\right)}}, x, 1\right) \]
          7. Applied rewrites64.7%

            \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{t \cdot \left(y - z\right)}}, x, 1\right) \]
          8. Taylor expanded in t around 0

            \[\leadsto \color{blue}{\frac{x}{t \cdot \left(y - z\right)}} \]
          9. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{x}{t \cdot \left(y - z\right)}} \]
            2. lower-*.f64N/A

              \[\leadsto \frac{x}{\color{blue}{t \cdot \left(y - z\right)}} \]
            3. lower--.f6463.3

              \[\leadsto \frac{x}{t \cdot \color{blue}{\left(y - z\right)}} \]
          10. Applied rewrites63.3%

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

          if -400 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < 4.0000000000000001e-13

          1. Initial program 100.0%

            \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in x around 0

            \[\leadsto \color{blue}{1} \]
          4. Step-by-step derivation
            1. Applied rewrites99.1%

              \[\leadsto \color{blue}{1} \]
          5. Recombined 2 regimes into one program.
          6. Final simplification90.3%

            \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \leq -400:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\ \mathbf{elif}\;\frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \leq 4 \cdot 10^{-13}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\ \end{array} \]
          7. Add Preprocessing

          Alternative 6: 85.3% accurate, 0.3× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+29}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-13}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{z \cdot t}\\ \end{array} \end{array} \]
          (FPCore (x y z t)
           :precision binary64
           (let* ((t_1 (/ x (* (- y z) (- y t)))))
             (if (<= t_1 -2e+29)
               (/ (- x) (* z t))
               (if (<= t_1 4e-13) 1.0 (- 1.0 (/ x (* z t)))))))
          double code(double x, double y, double z, double t) {
          	double t_1 = x / ((y - z) * (y - t));
          	double tmp;
          	if (t_1 <= -2e+29) {
          		tmp = -x / (z * t);
          	} else if (t_1 <= 4e-13) {
          		tmp = 1.0;
          	} else {
          		tmp = 1.0 - (x / (z * t));
          	}
          	return tmp;
          }
          
          real(8) function code(x, y, z, t)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8), intent (in) :: t
              real(8) :: t_1
              real(8) :: tmp
              t_1 = x / ((y - z) * (y - t))
              if (t_1 <= (-2d+29)) then
                  tmp = -x / (z * t)
              else if (t_1 <= 4d-13) then
                  tmp = 1.0d0
              else
                  tmp = 1.0d0 - (x / (z * t))
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z, double t) {
          	double t_1 = x / ((y - z) * (y - t));
          	double tmp;
          	if (t_1 <= -2e+29) {
          		tmp = -x / (z * t);
          	} else if (t_1 <= 4e-13) {
          		tmp = 1.0;
          	} else {
          		tmp = 1.0 - (x / (z * t));
          	}
          	return tmp;
          }
          
          def code(x, y, z, t):
          	t_1 = x / ((y - z) * (y - t))
          	tmp = 0
          	if t_1 <= -2e+29:
          		tmp = -x / (z * t)
          	elif t_1 <= 4e-13:
          		tmp = 1.0
          	else:
          		tmp = 1.0 - (x / (z * t))
          	return tmp
          
          function code(x, y, z, t)
          	t_1 = Float64(x / Float64(Float64(y - z) * Float64(y - t)))
          	tmp = 0.0
          	if (t_1 <= -2e+29)
          		tmp = Float64(Float64(-x) / Float64(z * t));
          	elseif (t_1 <= 4e-13)
          		tmp = 1.0;
          	else
          		tmp = Float64(1.0 - Float64(x / Float64(z * t)));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z, t)
          	t_1 = x / ((y - z) * (y - t));
          	tmp = 0.0;
          	if (t_1 <= -2e+29)
          		tmp = -x / (z * t);
          	elseif (t_1 <= 4e-13)
          		tmp = 1.0;
          	else
          		tmp = 1.0 - (x / (z * t));
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+29], N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-13], 1.0, N[(1.0 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_1 := \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
          \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+29}:\\
          \;\;\;\;\frac{-x}{z \cdot t}\\
          
          \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-13}:\\
          \;\;\;\;1\\
          
          \mathbf{else}:\\
          \;\;\;\;1 - \frac{x}{z \cdot t}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < -1.99999999999999983e29

            1. Initial program 99.8%

              \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in y around 0

              \[\leadsto \color{blue}{1 - \frac{x}{t \cdot z}} \]
            4. Step-by-step derivation
              1. lower--.f64N/A

                \[\leadsto \color{blue}{1 - \frac{x}{t \cdot z}} \]
              2. lower-/.f64N/A

                \[\leadsto 1 - \color{blue}{\frac{x}{t \cdot z}} \]
              3. lower-*.f6460.6

                \[\leadsto 1 - \frac{x}{\color{blue}{t \cdot z}} \]
            5. Applied rewrites60.6%

              \[\leadsto \color{blue}{1 - \frac{x}{t \cdot z}} \]
            6. Taylor expanded in x around inf

              \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
            7. Step-by-step derivation
              1. associate-*r/N/A

                \[\leadsto \color{blue}{\frac{-1 \cdot x}{t \cdot z}} \]
              2. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{-1 \cdot x}{t \cdot z}} \]
              3. neg-mul-1N/A

                \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{t \cdot z} \]
              4. lower-neg.f64N/A

                \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{t \cdot z} \]
              5. lower-*.f6460.6

                \[\leadsto \frac{-x}{\color{blue}{t \cdot z}} \]
            8. Applied rewrites60.6%

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

            if -1.99999999999999983e29 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < 4.0000000000000001e-13

            1. Initial program 100.0%

              \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{1} \]
            4. Step-by-step derivation
              1. Applied rewrites98.2%

                \[\leadsto \color{blue}{1} \]

              if 4.0000000000000001e-13 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))

              1. Initial program 93.8%

                \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
              2. Add Preprocessing
              3. Taylor expanded in y around 0

                \[\leadsto \color{blue}{1 - \frac{x}{t \cdot z}} \]
              4. Step-by-step derivation
                1. lower--.f64N/A

                  \[\leadsto \color{blue}{1 - \frac{x}{t \cdot z}} \]
                2. lower-/.f64N/A

                  \[\leadsto 1 - \color{blue}{\frac{x}{t \cdot z}} \]
                3. lower-*.f6452.1

                  \[\leadsto 1 - \frac{x}{\color{blue}{t \cdot z}} \]
              5. Applied rewrites52.1%

                \[\leadsto \color{blue}{1 - \frac{x}{t \cdot z}} \]
            5. Recombined 3 regimes into one program.
            6. Final simplification88.2%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \leq -2 \cdot 10^{+29}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{elif}\;\frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \leq 4 \cdot 10^{-13}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{x}{z \cdot t}\\ \end{array} \]
            7. Add Preprocessing

            Alternative 7: 84.9% accurate, 0.3× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\ t_2 := \frac{-x}{z \cdot t}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+29}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-13}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
            (FPCore (x y z t)
             :precision binary64
             (let* ((t_1 (/ x (* (- y z) (- y t)))) (t_2 (/ (- x) (* z t))))
               (if (<= t_1 -2e+29) t_2 (if (<= t_1 4e-13) 1.0 t_2))))
            double code(double x, double y, double z, double t) {
            	double t_1 = x / ((y - z) * (y - t));
            	double t_2 = -x / (z * t);
            	double tmp;
            	if (t_1 <= -2e+29) {
            		tmp = t_2;
            	} else if (t_1 <= 4e-13) {
            		tmp = 1.0;
            	} else {
            		tmp = t_2;
            	}
            	return tmp;
            }
            
            real(8) function code(x, y, z, t)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8), intent (in) :: t
                real(8) :: t_1
                real(8) :: t_2
                real(8) :: tmp
                t_1 = x / ((y - z) * (y - t))
                t_2 = -x / (z * t)
                if (t_1 <= (-2d+29)) then
                    tmp = t_2
                else if (t_1 <= 4d-13) then
                    tmp = 1.0d0
                else
                    tmp = t_2
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z, double t) {
            	double t_1 = x / ((y - z) * (y - t));
            	double t_2 = -x / (z * t);
            	double tmp;
            	if (t_1 <= -2e+29) {
            		tmp = t_2;
            	} else if (t_1 <= 4e-13) {
            		tmp = 1.0;
            	} else {
            		tmp = t_2;
            	}
            	return tmp;
            }
            
            def code(x, y, z, t):
            	t_1 = x / ((y - z) * (y - t))
            	t_2 = -x / (z * t)
            	tmp = 0
            	if t_1 <= -2e+29:
            		tmp = t_2
            	elif t_1 <= 4e-13:
            		tmp = 1.0
            	else:
            		tmp = t_2
            	return tmp
            
            function code(x, y, z, t)
            	t_1 = Float64(x / Float64(Float64(y - z) * Float64(y - t)))
            	t_2 = Float64(Float64(-x) / Float64(z * t))
            	tmp = 0.0
            	if (t_1 <= -2e+29)
            		tmp = t_2;
            	elseif (t_1 <= 4e-13)
            		tmp = 1.0;
            	else
            		tmp = t_2;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z, t)
            	t_1 = x / ((y - z) * (y - t));
            	t_2 = -x / (z * t);
            	tmp = 0.0;
            	if (t_1 <= -2e+29)
            		tmp = t_2;
            	elseif (t_1 <= 4e-13)
            		tmp = 1.0;
            	else
            		tmp = t_2;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-x) / N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+29], t$95$2, If[LessEqual[t$95$1, 4e-13], 1.0, t$95$2]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_1 := \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
            t_2 := \frac{-x}{z \cdot t}\\
            \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+29}:\\
            \;\;\;\;t\_2\\
            
            \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-13}:\\
            \;\;\;\;1\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_2\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < -1.99999999999999983e29 or 4.0000000000000001e-13 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))

              1. Initial program 96.7%

                \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
              2. Add Preprocessing
              3. Taylor expanded in y around 0

                \[\leadsto \color{blue}{1 - \frac{x}{t \cdot z}} \]
              4. Step-by-step derivation
                1. lower--.f64N/A

                  \[\leadsto \color{blue}{1 - \frac{x}{t \cdot z}} \]
                2. lower-/.f64N/A

                  \[\leadsto 1 - \color{blue}{\frac{x}{t \cdot z}} \]
                3. lower-*.f6456.1

                  \[\leadsto 1 - \frac{x}{\color{blue}{t \cdot z}} \]
              5. Applied rewrites56.1%

                \[\leadsto \color{blue}{1 - \frac{x}{t \cdot z}} \]
              6. Taylor expanded in x around inf

                \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
              7. Step-by-step derivation
                1. associate-*r/N/A

                  \[\leadsto \color{blue}{\frac{-1 \cdot x}{t \cdot z}} \]
                2. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{-1 \cdot x}{t \cdot z}} \]
                3. neg-mul-1N/A

                  \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{t \cdot z} \]
                4. lower-neg.f64N/A

                  \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(x\right)}}{t \cdot z} \]
                5. lower-*.f6454.7

                  \[\leadsto \frac{-x}{\color{blue}{t \cdot z}} \]
              8. Applied rewrites54.7%

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

              if -1.99999999999999983e29 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < 4.0000000000000001e-13

              1. Initial program 100.0%

                \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
              2. Add Preprocessing
              3. Taylor expanded in x around 0

                \[\leadsto \color{blue}{1} \]
              4. Step-by-step derivation
                1. Applied rewrites98.2%

                  \[\leadsto \color{blue}{1} \]
              5. Recombined 2 regimes into one program.
              6. Final simplification87.8%

                \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \leq -2 \cdot 10^{+29}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{elif}\;\frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \leq 4 \cdot 10^{-13}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \end{array} \]
              7. Add Preprocessing

              Alternative 8: 74.8% accurate, 26.0× speedup?

              \[\begin{array}{l} \\ 1 \end{array} \]
              (FPCore (x y z t) :precision binary64 1.0)
              double code(double x, double y, double z, double t) {
              	return 1.0;
              }
              
              real(8) function code(x, y, z, t)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8), intent (in) :: z
                  real(8), intent (in) :: t
                  code = 1.0d0
              end function
              
              public static double code(double x, double y, double z, double t) {
              	return 1.0;
              }
              
              def code(x, y, z, t):
              	return 1.0
              
              function code(x, y, z, t)
              	return 1.0
              end
              
              function tmp = code(x, y, z, t)
              	tmp = 1.0;
              end
              
              code[x_, y_, z_, t_] := 1.0
              
              \begin{array}{l}
              
              \\
              1
              \end{array}
              
              Derivation
              1. Initial program 99.2%

                \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
              2. Add Preprocessing
              3. Taylor expanded in x around 0

                \[\leadsto \color{blue}{1} \]
              4. Step-by-step derivation
                1. Applied rewrites75.4%

                  \[\leadsto \color{blue}{1} \]
                2. Add Preprocessing

                Reproduce

                ?
                herbie shell --seed 2024219 
                (FPCore (x y z t)
                  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A"
                  :precision binary64
                  (- 1.0 (/ x (* (- y z) (- y t)))))