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

Percentage Accurate: 99.1% → 99.1%
Time: 3.3s
Alternatives: 8
Speedup: 0.1×

Specification

?
\[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
(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)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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]
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}

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.1% accurate, 1.0× speedup?

\[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
(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)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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]
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}

Alternative 1: 99.1% accurate, 0.1× speedup?

\[1 - \frac{\frac{x}{\mathsf{min}\left(z, t\right) - y}}{\mathsf{max}\left(z, t\right) - y} \]
(FPCore (x y z t)
  :precision binary64
  (- 1.0 (/ (/ x (- (fmin z t) y)) (- (fmax z t) y))))
double code(double x, double y, double z, double t) {
	return 1.0 - ((x / (fmin(z, t) - y)) / (fmax(z, t) - y));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = 1.0d0 - ((x / (fmin(z, t) - y)) / (fmax(z, t) - y))
end function
public static double code(double x, double y, double z, double t) {
	return 1.0 - ((x / (fmin(z, t) - y)) / (fmax(z, t) - y));
}
def code(x, y, z, t):
	return 1.0 - ((x / (fmin(z, t) - y)) / (fmax(z, t) - y))
function code(x, y, z, t)
	return Float64(1.0 - Float64(Float64(x / Float64(fmin(z, t) - y)) / Float64(fmax(z, t) - y)))
end
function tmp = code(x, y, z, t)
	tmp = 1.0 - ((x / (min(z, t) - y)) / (max(z, t) - y));
end
code[x_, y_, z_, t_] := N[(1.0 - N[(N[(x / N[(N[Min[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] / N[(N[Max[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
1 - \frac{\frac{x}{\mathsf{min}\left(z, t\right) - y}}{\mathsf{max}\left(z, t\right) - y}
Derivation
  1. Initial program 99.1%

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

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

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

      \[\leadsto 1 - \color{blue}{\frac{\frac{x}{y - z}}{y - t}} \]
    4. frac-2negN/A

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

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

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

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

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

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

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

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

      \[\leadsto 1 - \frac{\frac{x}{\color{blue}{z - y}}}{t - y} \]
    13. lower--.f6498.3%

      \[\leadsto 1 - \frac{\frac{x}{z - y}}{\color{blue}{t - y}} \]
  3. Applied rewrites98.3%

    \[\leadsto 1 - \color{blue}{\frac{\frac{x}{z - y}}{t - y}} \]
  4. Add Preprocessing

Alternative 2: 97.1% accurate, 0.3× speedup?

\[\begin{array}{l} t_1 := \frac{x}{\left(t - y\right) \cdot \left(y - z\right)}\\ t_2 := 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{+19}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 2:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t)
  :precision binary64
  (let* ((t_1 (/ x (* (- t y) (- y z))))
       (t_2 (- 1.0 (/ x (* (- y z) (- y t))))))
  (if (<= t_2 -5e+19) t_1 (if (<= t_2 2.0) 1.0 t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x / ((t - y) * (y - z));
	double t_2 = 1.0 - (x / ((y - z) * (y - t)));
	double tmp;
	if (t_2 <= -5e+19) {
		tmp = t_1;
	} else if (t_2 <= 2.0) {
		tmp = 1.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    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 / ((t - y) * (y - z))
    t_2 = 1.0d0 - (x / ((y - z) * (y - t)))
    if (t_2 <= (-5d+19)) then
        tmp = t_1
    else if (t_2 <= 2.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 / ((t - y) * (y - z));
	double t_2 = 1.0 - (x / ((y - z) * (y - t)));
	double tmp;
	if (t_2 <= -5e+19) {
		tmp = t_1;
	} else if (t_2 <= 2.0) {
		tmp = 1.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x / ((t - y) * (y - z))
	t_2 = 1.0 - (x / ((y - z) * (y - t)))
	tmp = 0
	if t_2 <= -5e+19:
		tmp = t_1
	elif t_2 <= 2.0:
		tmp = 1.0
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x / Float64(Float64(t - y) * Float64(y - z)))
	t_2 = Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t))))
	tmp = 0.0
	if (t_2 <= -5e+19)
		tmp = t_1;
	elseif (t_2 <= 2.0)
		tmp = 1.0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x / ((t - y) * (y - z));
	t_2 = 1.0 - (x / ((y - z) * (y - t)));
	tmp = 0.0;
	if (t_2 <= -5e+19)
		tmp = t_1;
	elseif (t_2 <= 2.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[(N[(t - y), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+19], t$95$1, If[LessEqual[t$95$2, 2.0], 1.0, t$95$1]]]]
\begin{array}{l}
t_1 := \frac{x}{\left(t - y\right) \cdot \left(y - z\right)}\\
t_2 := 1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\

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

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


\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)))) < -5e19 or 2 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))))

    1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.1%

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

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

        \[\leadsto \color{blue}{1} \]
    4. Recombined 2 regimes into one program.
    5. Add Preprocessing

    Alternative 3: 89.1% accurate, 0.0× speedup?

    \[\begin{array}{l} t_1 := y - \mathsf{max}\left(z, t\right)\\ t_2 := y - \mathsf{min}\left(z, t\right)\\ t_3 := 1 - \frac{x}{t\_2 \cdot t\_1}\\ \mathbf{if}\;t\_3 \leq -5 \cdot 10^{+19}:\\ \;\;\;\;\frac{x}{\mathsf{min}\left(z, t\right) \cdot t\_1}\\ \mathbf{elif}\;t\_3 \leq 20:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\mathsf{max}\left(z, t\right) \cdot t\_2}\\ \end{array} \]
    (FPCore (x y z t)
      :precision binary64
      (let* ((t_1 (- y (fmax z t)))
           (t_2 (- y (fmin z t)))
           (t_3 (- 1.0 (/ x (* t_2 t_1)))))
      (if (<= t_3 -5e+19)
        (/ x (* (fmin z t) t_1))
        (if (<= t_3 20.0) 1.0 (/ x (* (fmax z t) t_2))))))
    double code(double x, double y, double z, double t) {
    	double t_1 = y - fmax(z, t);
    	double t_2 = y - fmin(z, t);
    	double t_3 = 1.0 - (x / (t_2 * t_1));
    	double tmp;
    	if (t_3 <= -5e+19) {
    		tmp = x / (fmin(z, t) * t_1);
    	} else if (t_3 <= 20.0) {
    		tmp = 1.0;
    	} else {
    		tmp = x / (fmax(z, t) * t_2);
    	}
    	return tmp;
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(x, y, z, t)
    use fmin_fmax_functions
        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) :: t_3
        real(8) :: tmp
        t_1 = y - fmax(z, t)
        t_2 = y - fmin(z, t)
        t_3 = 1.0d0 - (x / (t_2 * t_1))
        if (t_3 <= (-5d+19)) then
            tmp = x / (fmin(z, t) * t_1)
        else if (t_3 <= 20.0d0) then
            tmp = 1.0d0
        else
            tmp = x / (fmax(z, t) * t_2)
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t) {
    	double t_1 = y - fmax(z, t);
    	double t_2 = y - fmin(z, t);
    	double t_3 = 1.0 - (x / (t_2 * t_1));
    	double tmp;
    	if (t_3 <= -5e+19) {
    		tmp = x / (fmin(z, t) * t_1);
    	} else if (t_3 <= 20.0) {
    		tmp = 1.0;
    	} else {
    		tmp = x / (fmax(z, t) * t_2);
    	}
    	return tmp;
    }
    
    def code(x, y, z, t):
    	t_1 = y - fmax(z, t)
    	t_2 = y - fmin(z, t)
    	t_3 = 1.0 - (x / (t_2 * t_1))
    	tmp = 0
    	if t_3 <= -5e+19:
    		tmp = x / (fmin(z, t) * t_1)
    	elif t_3 <= 20.0:
    		tmp = 1.0
    	else:
    		tmp = x / (fmax(z, t) * t_2)
    	return tmp
    
    function code(x, y, z, t)
    	t_1 = Float64(y - fmax(z, t))
    	t_2 = Float64(y - fmin(z, t))
    	t_3 = Float64(1.0 - Float64(x / Float64(t_2 * t_1)))
    	tmp = 0.0
    	if (t_3 <= -5e+19)
    		tmp = Float64(x / Float64(fmin(z, t) * t_1));
    	elseif (t_3 <= 20.0)
    		tmp = 1.0;
    	else
    		tmp = Float64(x / Float64(fmax(z, t) * t_2));
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t)
    	t_1 = y - max(z, t);
    	t_2 = y - min(z, t);
    	t_3 = 1.0 - (x / (t_2 * t_1));
    	tmp = 0.0;
    	if (t_3 <= -5e+19)
    		tmp = x / (min(z, t) * t_1);
    	elseif (t_3 <= 20.0)
    		tmp = 1.0;
    	else
    		tmp = x / (max(z, t) * t_2);
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y - N[Max[z, t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y - N[Min[z, t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 - N[(x / N[(t$95$2 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e+19], N[(x / N[(N[Min[z, t], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 20.0], 1.0, N[(x / N[(N[Max[z, t], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    t_1 := y - \mathsf{max}\left(z, t\right)\\
    t_2 := y - \mathsf{min}\left(z, t\right)\\
    t_3 := 1 - \frac{x}{t\_2 \cdot t\_1}\\
    \mathbf{if}\;t\_3 \leq -5 \cdot 10^{+19}:\\
    \;\;\;\;\frac{x}{\mathsf{min}\left(z, t\right) \cdot t\_1}\\
    
    \mathbf{elif}\;t\_3 \leq 20:\\
    \;\;\;\;1\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x}{\mathsf{max}\left(z, t\right) \cdot t\_2}\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < -5e19

      1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\frac{x}{y - z}}{\color{blue}{t - y}} \]
        6. lift--.f64N/A

          \[\leadsto \frac{\frac{x}{y - z}}{t - \color{blue}{y}} \]
        7. sub-negate-revN/A

          \[\leadsto \frac{\frac{x}{y - z}}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
        8. lift--.f64N/A

          \[\leadsto \frac{\frac{x}{y - z}}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
        9. sub-negate-revN/A

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

          \[\leadsto \frac{\frac{x}{\mathsf{neg}\left(\left(z - y\right)\right)}}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
        11. distribute-frac-neg2N/A

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

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

          \[\leadsto \frac{\mathsf{neg}\left(\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(\left(z - y\right)\right)}\right)}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
        14. sub-negate-revN/A

          \[\leadsto \frac{\mathsf{neg}\left(\frac{\mathsf{neg}\left(x\right)}{y - z}\right)}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
        15. frac-2neg-revN/A

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

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

          \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(\left(z - y\right)\right)}}{y - t} \]
        18. lift--.f64N/A

          \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(\left(z - y\right)\right)}}{y - t} \]
        19. frac-2neg-revN/A

          \[\leadsto \frac{\frac{x}{z - y}}{\color{blue}{y} - t} \]
        20. lower-/.f6425.3%

          \[\leadsto \frac{\frac{x}{z - y}}{\color{blue}{y} - t} \]
      8. Applied rewrites25.3%

        \[\leadsto \frac{\frac{x}{z - y}}{\color{blue}{y - t}} \]
      9. Taylor expanded in z around inf

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

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

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

          \[\leadsto \frac{x}{z \cdot \left(y - t\right)} \]
      11. Applied rewrites18.2%

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

      if -5e19 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))) < 20

      1. Initial program 99.1%

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

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

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

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

        1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{x}{t \cdot \left(\color{blue}{y} - z\right)} \]
        8. Step-by-step derivation
          1. Applied rewrites17.7%

            \[\leadsto \frac{x}{t \cdot \left(\color{blue}{y} - z\right)} \]
        9. Recombined 3 regimes into one program.
        10. Add Preprocessing

        Alternative 4: 89.1% accurate, 0.0× speedup?

        \[\begin{array}{l} t_1 := y - \mathsf{max}\left(z, t\right)\\ t_2 := \frac{x}{\mathsf{min}\left(z, t\right) \cdot t\_1}\\ t_3 := 1 - \frac{x}{\left(y - \mathsf{min}\left(z, t\right)\right) \cdot t\_1}\\ \mathbf{if}\;t\_3 \leq -5 \cdot 10^{+19}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_3 \leq 2:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \]
        (FPCore (x y z t)
          :precision binary64
          (let* ((t_1 (- y (fmax z t)))
               (t_2 (/ x (* (fmin z t) t_1)))
               (t_3 (- 1.0 (/ x (* (- y (fmin z t)) t_1)))))
          (if (<= t_3 -5e+19) t_2 (if (<= t_3 2.0) 1.0 t_2))))
        double code(double x, double y, double z, double t) {
        	double t_1 = y - fmax(z, t);
        	double t_2 = x / (fmin(z, t) * t_1);
        	double t_3 = 1.0 - (x / ((y - fmin(z, t)) * t_1));
        	double tmp;
        	if (t_3 <= -5e+19) {
        		tmp = t_2;
        	} else if (t_3 <= 2.0) {
        		tmp = 1.0;
        	} else {
        		tmp = t_2;
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(x, y, z, t)
        use fmin_fmax_functions
            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) :: t_3
            real(8) :: tmp
            t_1 = y - fmax(z, t)
            t_2 = x / (fmin(z, t) * t_1)
            t_3 = 1.0d0 - (x / ((y - fmin(z, t)) * t_1))
            if (t_3 <= (-5d+19)) then
                tmp = t_2
            else if (t_3 <= 2.0d0) 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 = y - fmax(z, t);
        	double t_2 = x / (fmin(z, t) * t_1);
        	double t_3 = 1.0 - (x / ((y - fmin(z, t)) * t_1));
        	double tmp;
        	if (t_3 <= -5e+19) {
        		tmp = t_2;
        	} else if (t_3 <= 2.0) {
        		tmp = 1.0;
        	} else {
        		tmp = t_2;
        	}
        	return tmp;
        }
        
        def code(x, y, z, t):
        	t_1 = y - fmax(z, t)
        	t_2 = x / (fmin(z, t) * t_1)
        	t_3 = 1.0 - (x / ((y - fmin(z, t)) * t_1))
        	tmp = 0
        	if t_3 <= -5e+19:
        		tmp = t_2
        	elif t_3 <= 2.0:
        		tmp = 1.0
        	else:
        		tmp = t_2
        	return tmp
        
        function code(x, y, z, t)
        	t_1 = Float64(y - fmax(z, t))
        	t_2 = Float64(x / Float64(fmin(z, t) * t_1))
        	t_3 = Float64(1.0 - Float64(x / Float64(Float64(y - fmin(z, t)) * t_1)))
        	tmp = 0.0
        	if (t_3 <= -5e+19)
        		tmp = t_2;
        	elseif (t_3 <= 2.0)
        		tmp = 1.0;
        	else
        		tmp = t_2;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z, t)
        	t_1 = y - max(z, t);
        	t_2 = x / (min(z, t) * t_1);
        	t_3 = 1.0 - (x / ((y - min(z, t)) * t_1));
        	tmp = 0.0;
        	if (t_3 <= -5e+19)
        		tmp = t_2;
        	elseif (t_3 <= 2.0)
        		tmp = 1.0;
        	else
        		tmp = t_2;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y - N[Max[z, t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(N[Min[z, t], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 - N[(x / N[(N[(y - N[Min[z, t], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e+19], t$95$2, If[LessEqual[t$95$3, 2.0], 1.0, t$95$2]]]]]
        
        \begin{array}{l}
        t_1 := y - \mathsf{max}\left(z, t\right)\\
        t_2 := \frac{x}{\mathsf{min}\left(z, t\right) \cdot t\_1}\\
        t_3 := 1 - \frac{x}{\left(y - \mathsf{min}\left(z, t\right)\right) \cdot t\_1}\\
        \mathbf{if}\;t\_3 \leq -5 \cdot 10^{+19}:\\
        \;\;\;\;t\_2\\
        
        \mathbf{elif}\;t\_3 \leq 2:\\
        \;\;\;\;1\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_2\\
        
        
        \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)))) < -5e19 or 2 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))))

          1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\frac{x}{y - z}}{\color{blue}{t - y}} \]
            6. lift--.f64N/A

              \[\leadsto \frac{\frac{x}{y - z}}{t - \color{blue}{y}} \]
            7. sub-negate-revN/A

              \[\leadsto \frac{\frac{x}{y - z}}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
            8. lift--.f64N/A

              \[\leadsto \frac{\frac{x}{y - z}}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
            9. sub-negate-revN/A

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

              \[\leadsto \frac{\frac{x}{\mathsf{neg}\left(\left(z - y\right)\right)}}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
            11. distribute-frac-neg2N/A

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

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

              \[\leadsto \frac{\mathsf{neg}\left(\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(\left(z - y\right)\right)}\right)}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
            14. sub-negate-revN/A

              \[\leadsto \frac{\mathsf{neg}\left(\frac{\mathsf{neg}\left(x\right)}{y - z}\right)}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
            15. frac-2neg-revN/A

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

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

              \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(\left(z - y\right)\right)}}{y - t} \]
            18. lift--.f64N/A

              \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(\left(z - y\right)\right)}}{y - t} \]
            19. frac-2neg-revN/A

              \[\leadsto \frac{\frac{x}{z - y}}{\color{blue}{y} - t} \]
            20. lower-/.f6425.3%

              \[\leadsto \frac{\frac{x}{z - y}}{\color{blue}{y} - t} \]
          8. Applied rewrites25.3%

            \[\leadsto \frac{\frac{x}{z - y}}{\color{blue}{y - t}} \]
          9. Taylor expanded in z around inf

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

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

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

              \[\leadsto \frac{x}{z \cdot \left(y - t\right)} \]
          11. Applied rewrites18.2%

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

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

          1. Initial program 99.1%

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

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

              \[\leadsto \color{blue}{1} \]
          4. Recombined 2 regimes into one program.
          5. Add Preprocessing

          Alternative 5: 83.9% accurate, 0.0× speedup?

          \[\begin{array}{l} t_1 := \frac{x}{y \cdot \left(\mathsf{min}\left(z, t\right) - y\right)}\\ t_2 := 1 - \frac{x}{\left(y - \mathsf{min}\left(z, t\right)\right) \cdot \left(y - \mathsf{max}\left(z, t\right)\right)}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{+19}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+67}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
          (FPCore (x y z t)
            :precision binary64
            (let* ((t_1 (/ x (* y (- (fmin z t) y))))
                 (t_2 (- 1.0 (/ x (* (- y (fmin z t)) (- y (fmax z t)))))))
            (if (<= t_2 -5e+19) t_1 (if (<= t_2 2e+67) 1.0 t_1))))
          double code(double x, double y, double z, double t) {
          	double t_1 = x / (y * (fmin(z, t) - y));
          	double t_2 = 1.0 - (x / ((y - fmin(z, t)) * (y - fmax(z, t))));
          	double tmp;
          	if (t_2 <= -5e+19) {
          		tmp = t_1;
          	} else if (t_2 <= 2e+67) {
          		tmp = 1.0;
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x, y, z, t)
          use fmin_fmax_functions
              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 * (fmin(z, t) - y))
              t_2 = 1.0d0 - (x / ((y - fmin(z, t)) * (y - fmax(z, t))))
              if (t_2 <= (-5d+19)) then
                  tmp = t_1
              else if (t_2 <= 2d+67) 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 * (fmin(z, t) - y));
          	double t_2 = 1.0 - (x / ((y - fmin(z, t)) * (y - fmax(z, t))));
          	double tmp;
          	if (t_2 <= -5e+19) {
          		tmp = t_1;
          	} else if (t_2 <= 2e+67) {
          		tmp = 1.0;
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          def code(x, y, z, t):
          	t_1 = x / (y * (fmin(z, t) - y))
          	t_2 = 1.0 - (x / ((y - fmin(z, t)) * (y - fmax(z, t))))
          	tmp = 0
          	if t_2 <= -5e+19:
          		tmp = t_1
          	elif t_2 <= 2e+67:
          		tmp = 1.0
          	else:
          		tmp = t_1
          	return tmp
          
          function code(x, y, z, t)
          	t_1 = Float64(x / Float64(y * Float64(fmin(z, t) - y)))
          	t_2 = Float64(1.0 - Float64(x / Float64(Float64(y - fmin(z, t)) * Float64(y - fmax(z, t)))))
          	tmp = 0.0
          	if (t_2 <= -5e+19)
          		tmp = t_1;
          	elseif (t_2 <= 2e+67)
          		tmp = 1.0;
          	else
          		tmp = t_1;
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z, t)
          	t_1 = x / (y * (min(z, t) - y));
          	t_2 = 1.0 - (x / ((y - min(z, t)) * (y - max(z, t))));
          	tmp = 0.0;
          	if (t_2 <= -5e+19)
          		tmp = t_1;
          	elseif (t_2 <= 2e+67)
          		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 * N[(N[Min[z, t], $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(x / N[(N[(y - N[Min[z, t], $MachinePrecision]), $MachinePrecision] * N[(y - N[Max[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+19], t$95$1, If[LessEqual[t$95$2, 2e+67], 1.0, t$95$1]]]]
          
          \begin{array}{l}
          t_1 := \frac{x}{y \cdot \left(\mathsf{min}\left(z, t\right) - y\right)}\\
          t_2 := 1 - \frac{x}{\left(y - \mathsf{min}\left(z, t\right)\right) \cdot \left(y - \mathsf{max}\left(z, t\right)\right)}\\
          \mathbf{if}\;t\_2 \leq -5 \cdot 10^{+19}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+67}:\\
          \;\;\;\;1\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_1\\
          
          
          \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)))) < -5e19 or 2e67 < (-.f64 #s(literal 1 binary64) (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))))

            1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\frac{x}{y - z}}{\color{blue}{t - y}} \]
              6. lift--.f64N/A

                \[\leadsto \frac{\frac{x}{y - z}}{t - \color{blue}{y}} \]
              7. sub-negate-revN/A

                \[\leadsto \frac{\frac{x}{y - z}}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
              8. lift--.f64N/A

                \[\leadsto \frac{\frac{x}{y - z}}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
              9. sub-negate-revN/A

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

                \[\leadsto \frac{\frac{x}{\mathsf{neg}\left(\left(z - y\right)\right)}}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
              11. distribute-frac-neg2N/A

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

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

                \[\leadsto \frac{\mathsf{neg}\left(\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(\left(z - y\right)\right)}\right)}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
              14. sub-negate-revN/A

                \[\leadsto \frac{\mathsf{neg}\left(\frac{\mathsf{neg}\left(x\right)}{y - z}\right)}{\mathsf{neg}\left(\left(y - t\right)\right)} \]
              15. frac-2neg-revN/A

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

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

                \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(\left(z - y\right)\right)}}{y - t} \]
              18. lift--.f64N/A

                \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(\left(z - y\right)\right)}}{y - t} \]
              19. frac-2neg-revN/A

                \[\leadsto \frac{\frac{x}{z - y}}{\color{blue}{y} - t} \]
              20. lower-/.f6425.3%

                \[\leadsto \frac{\frac{x}{z - y}}{\color{blue}{y} - t} \]
            8. Applied rewrites25.3%

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

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

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

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

                \[\leadsto \frac{x}{y \cdot \left(z - y\right)} \]
            11. Applied rewrites13.7%

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

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

            1. Initial program 99.1%

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

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

                \[\leadsto \color{blue}{1} \]
            4. Recombined 2 regimes into one program.
            5. Add Preprocessing

            Alternative 6: 80.9% accurate, 0.4× speedup?

            \[\begin{array}{l} t_1 := \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\ t_2 := \frac{x}{y \cdot t}\\ \mathbf{if}\;t\_1 \leq -4 \cdot 10^{+25}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 10^{+20}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \]
            (FPCore (x y z t)
              :precision binary64
              (let* ((t_1 (/ x (* (- y z) (- y t)))) (t_2 (/ x (* y t))))
              (if (<= t_1 -4e+25) t_2 (if (<= t_1 1e+20) 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 * t);
            	double tmp;
            	if (t_1 <= -4e+25) {
            		tmp = t_2;
            	} else if (t_1 <= 1e+20) {
            		tmp = 1.0;
            	} else {
            		tmp = t_2;
            	}
            	return tmp;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, z, t)
            use fmin_fmax_functions
                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 * t)
                if (t_1 <= (-4d+25)) then
                    tmp = t_2
                else if (t_1 <= 1d+20) 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 * t);
            	double tmp;
            	if (t_1 <= -4e+25) {
            		tmp = t_2;
            	} else if (t_1 <= 1e+20) {
            		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 * t)
            	tmp = 0
            	if t_1 <= -4e+25:
            		tmp = t_2
            	elif t_1 <= 1e+20:
            		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(y * t))
            	tmp = 0.0
            	if (t_1 <= -4e+25)
            		tmp = t_2;
            	elseif (t_1 <= 1e+20)
            		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 * t);
            	tmp = 0.0;
            	if (t_1 <= -4e+25)
            		tmp = t_2;
            	elseif (t_1 <= 1e+20)
            		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[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+25], t$95$2, If[LessEqual[t$95$1, 1e+20], 1.0, t$95$2]]]]
            
            \begin{array}{l}
            t_1 := \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
            t_2 := \frac{x}{y \cdot t}\\
            \mathbf{if}\;t\_1 \leq -4 \cdot 10^{+25}:\\
            \;\;\;\;t\_2\\
            
            \mathbf{elif}\;t\_1 \leq 10^{+20}:\\
            \;\;\;\;1\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_2\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < -4.0000000000000004e25 or 1e20 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))

              1. Initial program 99.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{x}{y \cdot \left(t - y\right)} \]
              9. Applied rewrites13.3%

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

                \[\leadsto \frac{x}{y \cdot t} \]
              11. Step-by-step derivation
                1. Applied rewrites9.5%

                  \[\leadsto \frac{x}{y \cdot t} \]

                if -4.0000000000000004e25 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < 1e20

                1. Initial program 99.1%

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

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

                    \[\leadsto \color{blue}{1} \]
                4. Recombined 2 regimes into one program.
                5. Add Preprocessing

                Alternative 7: 75.0% accurate, 26.0× speedup?

                \[1 \]
                (FPCore (x y z t)
                  :precision binary64
                  1.0)
                double code(double x, double y, double z, double t) {
                	return 1.0;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x, y, z, t)
                use fmin_fmax_functions
                    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
                
                1
                
                Derivation
                1. Initial program 99.1%

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

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

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

                  Reproduce

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