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

Percentage Accurate: 89.0% → 96.8%
Time: 3.3s
Alternatives: 12
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
double code(double x, double y, double z, double t) {
	return x / ((y - z) * (t - z));
}
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 = x / ((y - z) * (t - z))
end function
public static double code(double x, double y, double z, double t) {
	return x / ((y - z) * (t - z));
}
def code(x, y, z, t):
	return x / ((y - z) * (t - z))
function code(x, y, z, t)
	return Float64(x / Float64(Float64(y - z) * Float64(t - z)))
end
function tmp = code(x, y, z, t)
	tmp = x / ((y - z) * (t - z));
end
code[x_, y_, z_, t_] := N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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 12 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: 89.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
double code(double x, double y, double z, double t) {
	return x / ((y - z) * (t - z));
}
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 = x / ((y - z) * (t - z))
end function
public static double code(double x, double y, double z, double t) {
	return x / ((y - z) * (t - z));
}
def code(x, y, z, t):
	return x / ((y - z) * (t - z))
function code(x, y, z, t)
	return Float64(x / Float64(Float64(y - z) * Float64(t - z)))
end
function tmp = code(x, y, z, t)
	tmp = x / ((y - z) * (t - z));
end
code[x_, y_, z_, t_] := N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 96.8% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \frac{\frac{x}{t - z}}{y - z} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t) :precision binary64 (/ (/ x (- t z)) (- y z)))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	return (x / (t - z)) / (y - z);
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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 = (x / (t - z)) / (y - z)
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	return (x / (t - z)) / (y - z);
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	return (x / (t - z)) / (y - z)
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	return Float64(Float64(x / Float64(t - z)) / Float64(y - z))
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp = code(x, y, z, t)
	tmp = (x / (t - z)) / (y - z);
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\frac{\frac{x}{t - z}}{y - z}
\end{array}
Derivation
  1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
    10. lift--.f6496.8

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

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

Alternative 2: 92.2% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \left(y - z\right) \cdot \left(t - z\right)\\ \mathbf{if}\;t\_1 \leq 10^{+308}:\\ \;\;\;\;\frac{x}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{-z}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (- y z) (- t z))))
   (if (<= t_1 1e+308) (/ x t_1) (/ (/ x (- t z)) (- z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double t_1 = (y - z) * (t - z);
	double tmp;
	if (t_1 <= 1e+308) {
		tmp = x / t_1;
	} else {
		tmp = (x / (t - z)) / -z;
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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) :: tmp
    t_1 = (y - z) * (t - z)
    if (t_1 <= 1d+308) then
        tmp = x / t_1
    else
        tmp = (x / (t - z)) / -z
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double t_1 = (y - z) * (t - z);
	double tmp;
	if (t_1 <= 1e+308) {
		tmp = x / t_1;
	} else {
		tmp = (x / (t - z)) / -z;
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	t_1 = (y - z) * (t - z)
	tmp = 0
	if t_1 <= 1e+308:
		tmp = x / t_1
	else:
		tmp = (x / (t - z)) / -z
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	t_1 = Float64(Float64(y - z) * Float64(t - z))
	tmp = 0.0
	if (t_1 <= 1e+308)
		tmp = Float64(x / t_1);
	else
		tmp = Float64(Float64(x / Float64(t - z)) / Float64(-z));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	t_1 = (y - z) * (t - z);
	tmp = 0.0;
	if (t_1 <= 1e+308)
		tmp = x / t_1;
	else
		tmp = (x / (t - z)) / -z;
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+308], N[(x / t$95$1), $MachinePrecision], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] / (-z)), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \left(t - z\right)\\
\mathbf{if}\;t\_1 \leq 10^{+308}:\\
\;\;\;\;\frac{x}{t\_1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (-.f64 y z) (-.f64 t z)) < 1e308

    1. Initial program 89.0%

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

    if 1e308 < (*.f64 (-.f64 y z) (-.f64 t z))

    1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
      10. lift--.f6496.8

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

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

      \[\leadsto \frac{\frac{x}{t - z}}{\color{blue}{-1 \cdot z}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\frac{x}{t - z}}{\mathsf{neg}\left(z\right)} \]
      2. lift-neg.f6459.2

        \[\leadsto \frac{\frac{x}{t - z}}{-z} \]
    6. Applied rewrites59.2%

      \[\leadsto \frac{\frac{x}{t - z}}{\color{blue}{-z}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 80.6% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -3.9 \cdot 10^{-28}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot y}\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-203}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{-z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{y - z}\\ \end{array} \end{array} \]
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t)
 :precision binary64
 (if (<= y -3.9e-28)
   (/ x (* (- t z) y))
   (if (<= y 1.8e-203) (/ (/ x (- t z)) (- z)) (/ (/ x t) (- y z)))))
assert(x < y && y < z && z < t);
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -3.9e-28) {
		tmp = x / ((t - z) * y);
	} else if (y <= 1.8e-203) {
		tmp = (x / (t - z)) / -z;
	} else {
		tmp = (x / t) / (y - z);
	}
	return tmp;
}
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
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) :: tmp
    if (y <= (-3.9d-28)) then
        tmp = x / ((t - z) * y)
    else if (y <= 1.8d-203) then
        tmp = (x / (t - z)) / -z
    else
        tmp = (x / t) / (y - z)
    end if
    code = tmp
end function
assert x < y && y < z && z < t;
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -3.9e-28) {
		tmp = x / ((t - z) * y);
	} else if (y <= 1.8e-203) {
		tmp = (x / (t - z)) / -z;
	} else {
		tmp = (x / t) / (y - z);
	}
	return tmp;
}
[x, y, z, t] = sort([x, y, z, t])
def code(x, y, z, t):
	tmp = 0
	if y <= -3.9e-28:
		tmp = x / ((t - z) * y)
	elif y <= 1.8e-203:
		tmp = (x / (t - z)) / -z
	else:
		tmp = (x / t) / (y - z)
	return tmp
x, y, z, t = sort([x, y, z, t])
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -3.9e-28)
		tmp = Float64(x / Float64(Float64(t - z) * y));
	elseif (y <= 1.8e-203)
		tmp = Float64(Float64(x / Float64(t - z)) / Float64(-z));
	else
		tmp = Float64(Float64(x / t) / Float64(y - z));
	end
	return tmp
end
x, y, z, t = num2cell(sort([x, y, z, t])){:}
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -3.9e-28)
		tmp = x / ((t - z) * y);
	elseif (y <= 1.8e-203)
		tmp = (x / (t - z)) / -z;
	else
		tmp = (x / t) / (y - z);
	end
	tmp_2 = tmp;
end
NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_] := If[LessEqual[y, -3.9e-28], N[(x / N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e-203], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] / (-z)), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{-28}:\\
\;\;\;\;\frac{x}{\left(t - z\right) \cdot y}\\

\mathbf{elif}\;y \leq 1.8 \cdot 10^{-203}:\\
\;\;\;\;\frac{\frac{x}{t - z}}{-z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.89999999999999999e-28

    1. Initial program 89.0%

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

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

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

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

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

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

    if -3.89999999999999999e-28 < y < 1.7999999999999999e-203

    1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
      10. lift--.f6496.8

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

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

      \[\leadsto \frac{\frac{x}{t - z}}{\color{blue}{-1 \cdot z}} \]
    5. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\frac{x}{t - z}}{\mathsf{neg}\left(z\right)} \]
      2. lift-neg.f6459.2

        \[\leadsto \frac{\frac{x}{t - z}}{-z} \]
    6. Applied rewrites59.2%

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

    if 1.7999999999999999e-203 < y

    1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
      10. lift--.f6496.8

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

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

      \[\leadsto \frac{\frac{x}{\color{blue}{t}}}{y - z} \]
    5. Step-by-step derivation
      1. Applied rewrites58.6%

        \[\leadsto \frac{\frac{x}{\color{blue}{t}}}{y - z} \]
    6. Recombined 3 regimes into one program.
    7. Add Preprocessing

    Alternative 4: 78.0% accurate, 0.6× speedup?

    \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -3.1 \cdot 10^{-218}:\\ \;\;\;\;\frac{\frac{x}{y}}{t - z}\\ \mathbf{elif}\;t \leq 7.5 \cdot 10^{+40}:\\ \;\;\;\;\frac{x}{\left(-z\right) \cdot \left(y - z\right)}\\ \mathbf{elif}\;t \leq 4.5 \cdot 10^{+202}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{y - z}\\ \end{array} \end{array} \]
    NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
    (FPCore (x y z t)
     :precision binary64
     (if (<= t -3.1e-218)
       (/ (/ x y) (- t z))
       (if (<= t 7.5e+40)
         (/ x (* (- z) (- y z)))
         (if (<= t 4.5e+202) (/ x (* (- y z) t)) (/ (/ x t) (- y z))))))
    assert(x < y && y < z && z < t);
    double code(double x, double y, double z, double t) {
    	double tmp;
    	if (t <= -3.1e-218) {
    		tmp = (x / y) / (t - z);
    	} else if (t <= 7.5e+40) {
    		tmp = x / (-z * (y - z));
    	} else if (t <= 4.5e+202) {
    		tmp = x / ((y - z) * t);
    	} else {
    		tmp = (x / t) / (y - z);
    	}
    	return tmp;
    }
    
    NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
    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) :: tmp
        if (t <= (-3.1d-218)) then
            tmp = (x / y) / (t - z)
        else if (t <= 7.5d+40) then
            tmp = x / (-z * (y - z))
        else if (t <= 4.5d+202) then
            tmp = x / ((y - z) * t)
        else
            tmp = (x / t) / (y - z)
        end if
        code = tmp
    end function
    
    assert x < y && y < z && z < t;
    public static double code(double x, double y, double z, double t) {
    	double tmp;
    	if (t <= -3.1e-218) {
    		tmp = (x / y) / (t - z);
    	} else if (t <= 7.5e+40) {
    		tmp = x / (-z * (y - z));
    	} else if (t <= 4.5e+202) {
    		tmp = x / ((y - z) * t);
    	} else {
    		tmp = (x / t) / (y - z);
    	}
    	return tmp;
    }
    
    [x, y, z, t] = sort([x, y, z, t])
    def code(x, y, z, t):
    	tmp = 0
    	if t <= -3.1e-218:
    		tmp = (x / y) / (t - z)
    	elif t <= 7.5e+40:
    		tmp = x / (-z * (y - z))
    	elif t <= 4.5e+202:
    		tmp = x / ((y - z) * t)
    	else:
    		tmp = (x / t) / (y - z)
    	return tmp
    
    x, y, z, t = sort([x, y, z, t])
    function code(x, y, z, t)
    	tmp = 0.0
    	if (t <= -3.1e-218)
    		tmp = Float64(Float64(x / y) / Float64(t - z));
    	elseif (t <= 7.5e+40)
    		tmp = Float64(x / Float64(Float64(-z) * Float64(y - z)));
    	elseif (t <= 4.5e+202)
    		tmp = Float64(x / Float64(Float64(y - z) * t));
    	else
    		tmp = Float64(Float64(x / t) / Float64(y - z));
    	end
    	return tmp
    end
    
    x, y, z, t = num2cell(sort([x, y, z, t])){:}
    function tmp_2 = code(x, y, z, t)
    	tmp = 0.0;
    	if (t <= -3.1e-218)
    		tmp = (x / y) / (t - z);
    	elseif (t <= 7.5e+40)
    		tmp = x / (-z * (y - z));
    	elseif (t <= 4.5e+202)
    		tmp = x / ((y - z) * t);
    	else
    		tmp = (x / t) / (y - z);
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
    code[x_, y_, z_, t_] := If[LessEqual[t, -3.1e-218], N[(N[(x / y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.5e+40], N[(x / N[((-z) * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.5e+202], N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]
    
    \begin{array}{l}
    [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;t \leq -3.1 \cdot 10^{-218}:\\
    \;\;\;\;\frac{\frac{x}{y}}{t - z}\\
    
    \mathbf{elif}\;t \leq 7.5 \cdot 10^{+40}:\\
    \;\;\;\;\frac{x}{\left(-z\right) \cdot \left(y - z\right)}\\
    
    \mathbf{elif}\;t \leq 4.5 \cdot 10^{+202}:\\
    \;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{x}{t}}{y - z}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if t < -3.09999999999999997e-218

      1. Initial program 89.0%

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\frac{x}{\color{blue}{y - z}}}{t - z} \]
        9. lift--.f6497.1

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{t - z} \]
      5. Step-by-step derivation
        1. lower-/.f6459.5

          \[\leadsto \frac{\frac{x}{\color{blue}{y}}}{t - z} \]
      6. Applied rewrites59.5%

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

      if -3.09999999999999997e-218 < t < 7.4999999999999996e40

      1. Initial program 89.0%

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

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

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

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

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

          \[\leadsto \frac{x}{\left(-z\right) \cdot \left(\color{blue}{y} - z\right)} \]
        5. lift--.f6452.9

          \[\leadsto \frac{x}{\left(-z\right) \cdot \left(y - \color{blue}{z}\right)} \]
      4. Applied rewrites52.9%

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

      if 7.4999999999999996e40 < t < 4.49999999999999978e202

      1. Initial program 89.0%

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

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

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

        if 4.49999999999999978e202 < t

        1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
          10. lift--.f6496.8

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

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

          \[\leadsto \frac{\frac{x}{\color{blue}{t}}}{y - z} \]
        5. Step-by-step derivation
          1. Applied rewrites58.6%

            \[\leadsto \frac{\frac{x}{\color{blue}{t}}}{y - z} \]
        6. Recombined 4 regimes into one program.
        7. Add Preprocessing

        Alternative 5: 74.2% accurate, 0.6× speedup?

        \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -1.18 \cdot 10^{-205}:\\ \;\;\;\;\frac{\frac{x}{y}}{t - z}\\ \mathbf{elif}\;t \leq 4.2 \cdot 10^{-40}:\\ \;\;\;\;\frac{\frac{-x}{z}}{-z}\\ \mathbf{elif}\;t \leq 4.5 \cdot 10^{+202}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{y - z}\\ \end{array} \end{array} \]
        NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
        (FPCore (x y z t)
         :precision binary64
         (if (<= t -1.18e-205)
           (/ (/ x y) (- t z))
           (if (<= t 4.2e-40)
             (/ (/ (- x) z) (- z))
             (if (<= t 4.5e+202) (/ x (* (- y z) t)) (/ (/ x t) (- y z))))))
        assert(x < y && y < z && z < t);
        double code(double x, double y, double z, double t) {
        	double tmp;
        	if (t <= -1.18e-205) {
        		tmp = (x / y) / (t - z);
        	} else if (t <= 4.2e-40) {
        		tmp = (-x / z) / -z;
        	} else if (t <= 4.5e+202) {
        		tmp = x / ((y - z) * t);
        	} else {
        		tmp = (x / t) / (y - z);
        	}
        	return tmp;
        }
        
        NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
        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) :: tmp
            if (t <= (-1.18d-205)) then
                tmp = (x / y) / (t - z)
            else if (t <= 4.2d-40) then
                tmp = (-x / z) / -z
            else if (t <= 4.5d+202) then
                tmp = x / ((y - z) * t)
            else
                tmp = (x / t) / (y - z)
            end if
            code = tmp
        end function
        
        assert x < y && y < z && z < t;
        public static double code(double x, double y, double z, double t) {
        	double tmp;
        	if (t <= -1.18e-205) {
        		tmp = (x / y) / (t - z);
        	} else if (t <= 4.2e-40) {
        		tmp = (-x / z) / -z;
        	} else if (t <= 4.5e+202) {
        		tmp = x / ((y - z) * t);
        	} else {
        		tmp = (x / t) / (y - z);
        	}
        	return tmp;
        }
        
        [x, y, z, t] = sort([x, y, z, t])
        def code(x, y, z, t):
        	tmp = 0
        	if t <= -1.18e-205:
        		tmp = (x / y) / (t - z)
        	elif t <= 4.2e-40:
        		tmp = (-x / z) / -z
        	elif t <= 4.5e+202:
        		tmp = x / ((y - z) * t)
        	else:
        		tmp = (x / t) / (y - z)
        	return tmp
        
        x, y, z, t = sort([x, y, z, t])
        function code(x, y, z, t)
        	tmp = 0.0
        	if (t <= -1.18e-205)
        		tmp = Float64(Float64(x / y) / Float64(t - z));
        	elseif (t <= 4.2e-40)
        		tmp = Float64(Float64(Float64(-x) / z) / Float64(-z));
        	elseif (t <= 4.5e+202)
        		tmp = Float64(x / Float64(Float64(y - z) * t));
        	else
        		tmp = Float64(Float64(x / t) / Float64(y - z));
        	end
        	return tmp
        end
        
        x, y, z, t = num2cell(sort([x, y, z, t])){:}
        function tmp_2 = code(x, y, z, t)
        	tmp = 0.0;
        	if (t <= -1.18e-205)
        		tmp = (x / y) / (t - z);
        	elseif (t <= 4.2e-40)
        		tmp = (-x / z) / -z;
        	elseif (t <= 4.5e+202)
        		tmp = x / ((y - z) * t);
        	else
        		tmp = (x / t) / (y - z);
        	end
        	tmp_2 = tmp;
        end
        
        NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
        code[x_, y_, z_, t_] := If[LessEqual[t, -1.18e-205], N[(N[(x / y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.2e-40], N[(N[((-x) / z), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[t, 4.5e+202], N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]
        
        \begin{array}{l}
        [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;t \leq -1.18 \cdot 10^{-205}:\\
        \;\;\;\;\frac{\frac{x}{y}}{t - z}\\
        
        \mathbf{elif}\;t \leq 4.2 \cdot 10^{-40}:\\
        \;\;\;\;\frac{\frac{-x}{z}}{-z}\\
        
        \mathbf{elif}\;t \leq 4.5 \cdot 10^{+202}:\\
        \;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\frac{x}{t}}{y - z}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 4 regimes
        2. if t < -1.18000000000000008e-205

          1. Initial program 89.0%

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\frac{x}{\color{blue}{y - z}}}{t - z} \]
            9. lift--.f6497.1

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

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

            \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{t - z} \]
          5. Step-by-step derivation
            1. lower-/.f6459.5

              \[\leadsto \frac{\frac{x}{\color{blue}{y}}}{t - z} \]
          6. Applied rewrites59.5%

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

          if -1.18000000000000008e-205 < t < 4.20000000000000036e-40

          1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
            10. lift--.f6496.8

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

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

            \[\leadsto \frac{\frac{x}{t - z}}{\color{blue}{-1 \cdot z}} \]
          5. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \frac{\frac{x}{t - z}}{\mathsf{neg}\left(z\right)} \]
            2. lift-neg.f6459.2

              \[\leadsto \frac{\frac{x}{t - z}}{-z} \]
          6. Applied rewrites59.2%

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

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

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

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

              \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{z}}{-z} \]
            4. lower-neg.f6443.5

              \[\leadsto \frac{\frac{-x}{z}}{-z} \]
          9. Applied rewrites43.5%

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

          if 4.20000000000000036e-40 < t < 4.49999999999999978e202

          1. Initial program 89.0%

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

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

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

            if 4.49999999999999978e202 < t

            1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
              10. lift--.f6496.8

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

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

              \[\leadsto \frac{\frac{x}{\color{blue}{t}}}{y - z} \]
            5. Step-by-step derivation
              1. Applied rewrites58.6%

                \[\leadsto \frac{\frac{x}{\color{blue}{t}}}{y - z} \]
            6. Recombined 4 regimes into one program.
            7. Add Preprocessing

            Alternative 6: 72.7% accurate, 0.7× speedup?

            \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -1.18 \cdot 10^{-205}:\\ \;\;\;\;\frac{\frac{x}{y}}{t - z}\\ \mathbf{elif}\;t \leq 4.2 \cdot 10^{-40}:\\ \;\;\;\;\frac{\frac{-x}{z}}{-z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\ \end{array} \end{array} \]
            NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
            (FPCore (x y z t)
             :precision binary64
             (if (<= t -1.18e-205)
               (/ (/ x y) (- t z))
               (if (<= t 4.2e-40) (/ (/ (- x) z) (- z)) (/ x (* (- y z) t)))))
            assert(x < y && y < z && z < t);
            double code(double x, double y, double z, double t) {
            	double tmp;
            	if (t <= -1.18e-205) {
            		tmp = (x / y) / (t - z);
            	} else if (t <= 4.2e-40) {
            		tmp = (-x / z) / -z;
            	} else {
            		tmp = x / ((y - z) * t);
            	}
            	return tmp;
            }
            
            NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
            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) :: tmp
                if (t <= (-1.18d-205)) then
                    tmp = (x / y) / (t - z)
                else if (t <= 4.2d-40) then
                    tmp = (-x / z) / -z
                else
                    tmp = x / ((y - z) * t)
                end if
                code = tmp
            end function
            
            assert x < y && y < z && z < t;
            public static double code(double x, double y, double z, double t) {
            	double tmp;
            	if (t <= -1.18e-205) {
            		tmp = (x / y) / (t - z);
            	} else if (t <= 4.2e-40) {
            		tmp = (-x / z) / -z;
            	} else {
            		tmp = x / ((y - z) * t);
            	}
            	return tmp;
            }
            
            [x, y, z, t] = sort([x, y, z, t])
            def code(x, y, z, t):
            	tmp = 0
            	if t <= -1.18e-205:
            		tmp = (x / y) / (t - z)
            	elif t <= 4.2e-40:
            		tmp = (-x / z) / -z
            	else:
            		tmp = x / ((y - z) * t)
            	return tmp
            
            x, y, z, t = sort([x, y, z, t])
            function code(x, y, z, t)
            	tmp = 0.0
            	if (t <= -1.18e-205)
            		tmp = Float64(Float64(x / y) / Float64(t - z));
            	elseif (t <= 4.2e-40)
            		tmp = Float64(Float64(Float64(-x) / z) / Float64(-z));
            	else
            		tmp = Float64(x / Float64(Float64(y - z) * t));
            	end
            	return tmp
            end
            
            x, y, z, t = num2cell(sort([x, y, z, t])){:}
            function tmp_2 = code(x, y, z, t)
            	tmp = 0.0;
            	if (t <= -1.18e-205)
            		tmp = (x / y) / (t - z);
            	elseif (t <= 4.2e-40)
            		tmp = (-x / z) / -z;
            	else
            		tmp = x / ((y - z) * t);
            	end
            	tmp_2 = tmp;
            end
            
            NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
            code[x_, y_, z_, t_] := If[LessEqual[t, -1.18e-205], N[(N[(x / y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.2e-40], N[(N[((-x) / z), $MachinePrecision] / (-z)), $MachinePrecision], N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]
            
            \begin{array}{l}
            [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
            \\
            \begin{array}{l}
            \mathbf{if}\;t \leq -1.18 \cdot 10^{-205}:\\
            \;\;\;\;\frac{\frac{x}{y}}{t - z}\\
            
            \mathbf{elif}\;t \leq 4.2 \cdot 10^{-40}:\\
            \;\;\;\;\frac{\frac{-x}{z}}{-z}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if t < -1.18000000000000008e-205

              1. Initial program 89.0%

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{\frac{x}{\color{blue}{y - z}}}{t - z} \]
                9. lift--.f6497.1

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

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

                \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{t - z} \]
              5. Step-by-step derivation
                1. lower-/.f6459.5

                  \[\leadsto \frac{\frac{x}{\color{blue}{y}}}{t - z} \]
              6. Applied rewrites59.5%

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

              if -1.18000000000000008e-205 < t < 4.20000000000000036e-40

              1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
                10. lift--.f6496.8

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

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

                \[\leadsto \frac{\frac{x}{t - z}}{\color{blue}{-1 \cdot z}} \]
              5. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto \frac{\frac{x}{t - z}}{\mathsf{neg}\left(z\right)} \]
                2. lift-neg.f6459.2

                  \[\leadsto \frac{\frac{x}{t - z}}{-z} \]
              6. Applied rewrites59.2%

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

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

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

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

                  \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{z}}{-z} \]
                4. lower-neg.f6443.5

                  \[\leadsto \frac{\frac{-x}{z}}{-z} \]
              9. Applied rewrites43.5%

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

              if 4.20000000000000036e-40 < t

              1. Initial program 89.0%

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

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

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

              Alternative 7: 72.4% accurate, 0.7× speedup?

              \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} \mathbf{if}\;t \leq -4.9 \cdot 10^{-207}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot y}\\ \mathbf{elif}\;t \leq 4.2 \cdot 10^{-40}:\\ \;\;\;\;\frac{\frac{-x}{z}}{-z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\ \end{array} \end{array} \]
              NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
              (FPCore (x y z t)
               :precision binary64
               (if (<= t -4.9e-207)
                 (/ x (* (- t z) y))
                 (if (<= t 4.2e-40) (/ (/ (- x) z) (- z)) (/ x (* (- y z) t)))))
              assert(x < y && y < z && z < t);
              double code(double x, double y, double z, double t) {
              	double tmp;
              	if (t <= -4.9e-207) {
              		tmp = x / ((t - z) * y);
              	} else if (t <= 4.2e-40) {
              		tmp = (-x / z) / -z;
              	} else {
              		tmp = x / ((y - z) * t);
              	}
              	return tmp;
              }
              
              NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
              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) :: tmp
                  if (t <= (-4.9d-207)) then
                      tmp = x / ((t - z) * y)
                  else if (t <= 4.2d-40) then
                      tmp = (-x / z) / -z
                  else
                      tmp = x / ((y - z) * t)
                  end if
                  code = tmp
              end function
              
              assert x < y && y < z && z < t;
              public static double code(double x, double y, double z, double t) {
              	double tmp;
              	if (t <= -4.9e-207) {
              		tmp = x / ((t - z) * y);
              	} else if (t <= 4.2e-40) {
              		tmp = (-x / z) / -z;
              	} else {
              		tmp = x / ((y - z) * t);
              	}
              	return tmp;
              }
              
              [x, y, z, t] = sort([x, y, z, t])
              def code(x, y, z, t):
              	tmp = 0
              	if t <= -4.9e-207:
              		tmp = x / ((t - z) * y)
              	elif t <= 4.2e-40:
              		tmp = (-x / z) / -z
              	else:
              		tmp = x / ((y - z) * t)
              	return tmp
              
              x, y, z, t = sort([x, y, z, t])
              function code(x, y, z, t)
              	tmp = 0.0
              	if (t <= -4.9e-207)
              		tmp = Float64(x / Float64(Float64(t - z) * y));
              	elseif (t <= 4.2e-40)
              		tmp = Float64(Float64(Float64(-x) / z) / Float64(-z));
              	else
              		tmp = Float64(x / Float64(Float64(y - z) * t));
              	end
              	return tmp
              end
              
              x, y, z, t = num2cell(sort([x, y, z, t])){:}
              function tmp_2 = code(x, y, z, t)
              	tmp = 0.0;
              	if (t <= -4.9e-207)
              		tmp = x / ((t - z) * y);
              	elseif (t <= 4.2e-40)
              		tmp = (-x / z) / -z;
              	else
              		tmp = x / ((y - z) * t);
              	end
              	tmp_2 = tmp;
              end
              
              NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
              code[x_, y_, z_, t_] := If[LessEqual[t, -4.9e-207], N[(x / N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.2e-40], N[(N[((-x) / z), $MachinePrecision] / (-z)), $MachinePrecision], N[(x / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]
              
              \begin{array}{l}
              [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
              \\
              \begin{array}{l}
              \mathbf{if}\;t \leq -4.9 \cdot 10^{-207}:\\
              \;\;\;\;\frac{x}{\left(t - z\right) \cdot y}\\
              
              \mathbf{elif}\;t \leq 4.2 \cdot 10^{-40}:\\
              \;\;\;\;\frac{\frac{-x}{z}}{-z}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if t < -4.9e-207

                1. Initial program 89.0%

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

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

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

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

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

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

                if -4.9e-207 < t < 4.20000000000000036e-40

                1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
                  10. lift--.f6496.8

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

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

                  \[\leadsto \frac{\frac{x}{t - z}}{\color{blue}{-1 \cdot z}} \]
                5. Step-by-step derivation
                  1. mul-1-negN/A

                    \[\leadsto \frac{\frac{x}{t - z}}{\mathsf{neg}\left(z\right)} \]
                  2. lift-neg.f6459.2

                    \[\leadsto \frac{\frac{x}{t - z}}{-z} \]
                6. Applied rewrites59.2%

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

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

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

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

                    \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{z}}{-z} \]
                  4. lower-neg.f6443.5

                    \[\leadsto \frac{\frac{-x}{z}}{-z} \]
                9. Applied rewrites43.5%

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

                if 4.20000000000000036e-40 < t

                1. Initial program 89.0%

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

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

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

                Alternative 8: 71.8% accurate, 0.6× speedup?

                \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \frac{\frac{-x}{z}}{-z}\\ \mathbf{if}\;z \leq -1.75 \cdot 10^{+84}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -3150000:\\ \;\;\;\;\frac{\frac{x}{t}}{-z}\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+30}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                (FPCore (x y z t)
                 :precision binary64
                 (let* ((t_1 (/ (/ (- x) z) (- z))))
                   (if (<= z -1.75e+84)
                     t_1
                     (if (<= z -3150000.0)
                       (/ (/ x t) (- z))
                       (if (<= z 2.8e+30) (/ x (* (- t z) y)) t_1)))))
                assert(x < y && y < z && z < t);
                double code(double x, double y, double z, double t) {
                	double t_1 = (-x / z) / -z;
                	double tmp;
                	if (z <= -1.75e+84) {
                		tmp = t_1;
                	} else if (z <= -3150000.0) {
                		tmp = (x / t) / -z;
                	} else if (z <= 2.8e+30) {
                		tmp = x / ((t - z) * y);
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                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) :: tmp
                    t_1 = (-x / z) / -z
                    if (z <= (-1.75d+84)) then
                        tmp = t_1
                    else if (z <= (-3150000.0d0)) then
                        tmp = (x / t) / -z
                    else if (z <= 2.8d+30) then
                        tmp = x / ((t - z) * y)
                    else
                        tmp = t_1
                    end if
                    code = tmp
                end function
                
                assert x < y && y < z && z < t;
                public static double code(double x, double y, double z, double t) {
                	double t_1 = (-x / z) / -z;
                	double tmp;
                	if (z <= -1.75e+84) {
                		tmp = t_1;
                	} else if (z <= -3150000.0) {
                		tmp = (x / t) / -z;
                	} else if (z <= 2.8e+30) {
                		tmp = x / ((t - z) * y);
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                [x, y, z, t] = sort([x, y, z, t])
                def code(x, y, z, t):
                	t_1 = (-x / z) / -z
                	tmp = 0
                	if z <= -1.75e+84:
                		tmp = t_1
                	elif z <= -3150000.0:
                		tmp = (x / t) / -z
                	elif z <= 2.8e+30:
                		tmp = x / ((t - z) * y)
                	else:
                		tmp = t_1
                	return tmp
                
                x, y, z, t = sort([x, y, z, t])
                function code(x, y, z, t)
                	t_1 = Float64(Float64(Float64(-x) / z) / Float64(-z))
                	tmp = 0.0
                	if (z <= -1.75e+84)
                		tmp = t_1;
                	elseif (z <= -3150000.0)
                		tmp = Float64(Float64(x / t) / Float64(-z));
                	elseif (z <= 2.8e+30)
                		tmp = Float64(x / Float64(Float64(t - z) * y));
                	else
                		tmp = t_1;
                	end
                	return tmp
                end
                
                x, y, z, t = num2cell(sort([x, y, z, t])){:}
                function tmp_2 = code(x, y, z, t)
                	t_1 = (-x / z) / -z;
                	tmp = 0.0;
                	if (z <= -1.75e+84)
                		tmp = t_1;
                	elseif (z <= -3150000.0)
                		tmp = (x / t) / -z;
                	elseif (z <= 2.8e+30)
                		tmp = x / ((t - z) * y);
                	else
                		tmp = t_1;
                	end
                	tmp_2 = tmp;
                end
                
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[((-x) / z), $MachinePrecision] / (-z)), $MachinePrecision]}, If[LessEqual[z, -1.75e+84], t$95$1, If[LessEqual[z, -3150000.0], N[(N[(x / t), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[z, 2.8e+30], N[(x / N[(N[(t - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
                
                \begin{array}{l}
                [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
                \\
                \begin{array}{l}
                t_1 := \frac{\frac{-x}{z}}{-z}\\
                \mathbf{if}\;z \leq -1.75 \cdot 10^{+84}:\\
                \;\;\;\;t\_1\\
                
                \mathbf{elif}\;z \leq -3150000:\\
                \;\;\;\;\frac{\frac{x}{t}}{-z}\\
                
                \mathbf{elif}\;z \leq 2.8 \cdot 10^{+30}:\\
                \;\;\;\;\frac{x}{\left(t - z\right) \cdot y}\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_1\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if z < -1.7499999999999999e84 or 2.79999999999999983e30 < z

                  1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
                    10. lift--.f6496.8

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

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

                    \[\leadsto \frac{\frac{x}{t - z}}{\color{blue}{-1 \cdot z}} \]
                  5. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \frac{\frac{x}{t - z}}{\mathsf{neg}\left(z\right)} \]
                    2. lift-neg.f6459.2

                      \[\leadsto \frac{\frac{x}{t - z}}{-z} \]
                  6. Applied rewrites59.2%

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

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

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

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

                      \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{z}}{-z} \]
                    4. lower-neg.f6443.5

                      \[\leadsto \frac{\frac{-x}{z}}{-z} \]
                  9. Applied rewrites43.5%

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

                  if -1.7499999999999999e84 < z < -3.15e6

                  1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
                    10. lift--.f6496.8

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

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

                    \[\leadsto \frac{\frac{x}{t - z}}{\color{blue}{-1 \cdot z}} \]
                  5. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \frac{\frac{x}{t - z}}{\mathsf{neg}\left(z\right)} \]
                    2. lift-neg.f6459.2

                      \[\leadsto \frac{\frac{x}{t - z}}{-z} \]
                  6. Applied rewrites59.2%

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

                    \[\leadsto \frac{\color{blue}{\frac{x}{t}}}{-z} \]
                  8. Step-by-step derivation
                    1. lower-/.f6432.3

                      \[\leadsto \frac{\frac{x}{\color{blue}{t}}}{-z} \]
                  9. Applied rewrites32.3%

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

                  if -3.15e6 < z < 2.79999999999999983e30

                  1. Initial program 89.0%

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

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

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

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

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

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

                Alternative 9: 64.1% accurate, 0.6× speedup?

                \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \frac{\frac{-x}{z}}{-z}\\ \mathbf{if}\;z \leq -1.75 \cdot 10^{+84}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-123}:\\ \;\;\;\;\frac{\frac{x}{t}}{-z}\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+29}:\\ \;\;\;\;\frac{x}{t \cdot y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                (FPCore (x y z t)
                 :precision binary64
                 (let* ((t_1 (/ (/ (- x) z) (- z))))
                   (if (<= z -1.75e+84)
                     t_1
                     (if (<= z -1.6e-123)
                       (/ (/ x t) (- z))
                       (if (<= z 5.2e+29) (/ x (* t y)) t_1)))))
                assert(x < y && y < z && z < t);
                double code(double x, double y, double z, double t) {
                	double t_1 = (-x / z) / -z;
                	double tmp;
                	if (z <= -1.75e+84) {
                		tmp = t_1;
                	} else if (z <= -1.6e-123) {
                		tmp = (x / t) / -z;
                	} else if (z <= 5.2e+29) {
                		tmp = x / (t * y);
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                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) :: tmp
                    t_1 = (-x / z) / -z
                    if (z <= (-1.75d+84)) then
                        tmp = t_1
                    else if (z <= (-1.6d-123)) then
                        tmp = (x / t) / -z
                    else if (z <= 5.2d+29) then
                        tmp = x / (t * y)
                    else
                        tmp = t_1
                    end if
                    code = tmp
                end function
                
                assert x < y && y < z && z < t;
                public static double code(double x, double y, double z, double t) {
                	double t_1 = (-x / z) / -z;
                	double tmp;
                	if (z <= -1.75e+84) {
                		tmp = t_1;
                	} else if (z <= -1.6e-123) {
                		tmp = (x / t) / -z;
                	} else if (z <= 5.2e+29) {
                		tmp = x / (t * y);
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                [x, y, z, t] = sort([x, y, z, t])
                def code(x, y, z, t):
                	t_1 = (-x / z) / -z
                	tmp = 0
                	if z <= -1.75e+84:
                		tmp = t_1
                	elif z <= -1.6e-123:
                		tmp = (x / t) / -z
                	elif z <= 5.2e+29:
                		tmp = x / (t * y)
                	else:
                		tmp = t_1
                	return tmp
                
                x, y, z, t = sort([x, y, z, t])
                function code(x, y, z, t)
                	t_1 = Float64(Float64(Float64(-x) / z) / Float64(-z))
                	tmp = 0.0
                	if (z <= -1.75e+84)
                		tmp = t_1;
                	elseif (z <= -1.6e-123)
                		tmp = Float64(Float64(x / t) / Float64(-z));
                	elseif (z <= 5.2e+29)
                		tmp = Float64(x / Float64(t * y));
                	else
                		tmp = t_1;
                	end
                	return tmp
                end
                
                x, y, z, t = num2cell(sort([x, y, z, t])){:}
                function tmp_2 = code(x, y, z, t)
                	t_1 = (-x / z) / -z;
                	tmp = 0.0;
                	if (z <= -1.75e+84)
                		tmp = t_1;
                	elseif (z <= -1.6e-123)
                		tmp = (x / t) / -z;
                	elseif (z <= 5.2e+29)
                		tmp = x / (t * y);
                	else
                		tmp = t_1;
                	end
                	tmp_2 = tmp;
                end
                
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[((-x) / z), $MachinePrecision] / (-z)), $MachinePrecision]}, If[LessEqual[z, -1.75e+84], t$95$1, If[LessEqual[z, -1.6e-123], N[(N[(x / t), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[z, 5.2e+29], N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
                
                \begin{array}{l}
                [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
                \\
                \begin{array}{l}
                t_1 := \frac{\frac{-x}{z}}{-z}\\
                \mathbf{if}\;z \leq -1.75 \cdot 10^{+84}:\\
                \;\;\;\;t\_1\\
                
                \mathbf{elif}\;z \leq -1.6 \cdot 10^{-123}:\\
                \;\;\;\;\frac{\frac{x}{t}}{-z}\\
                
                \mathbf{elif}\;z \leq 5.2 \cdot 10^{+29}:\\
                \;\;\;\;\frac{x}{t \cdot y}\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_1\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if z < -1.7499999999999999e84 or 5.2e29 < z

                  1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
                    10. lift--.f6496.8

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

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

                    \[\leadsto \frac{\frac{x}{t - z}}{\color{blue}{-1 \cdot z}} \]
                  5. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \frac{\frac{x}{t - z}}{\mathsf{neg}\left(z\right)} \]
                    2. lift-neg.f6459.2

                      \[\leadsto \frac{\frac{x}{t - z}}{-z} \]
                  6. Applied rewrites59.2%

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

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

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

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

                      \[\leadsto \frac{\frac{\mathsf{neg}\left(x\right)}{z}}{-z} \]
                    4. lower-neg.f6443.5

                      \[\leadsto \frac{\frac{-x}{z}}{-z} \]
                  9. Applied rewrites43.5%

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

                  if -1.7499999999999999e84 < z < -1.59999999999999989e-123

                  1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
                    10. lift--.f6496.8

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

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

                    \[\leadsto \frac{\frac{x}{t - z}}{\color{blue}{-1 \cdot z}} \]
                  5. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \frac{\frac{x}{t - z}}{\mathsf{neg}\left(z\right)} \]
                    2. lift-neg.f6459.2

                      \[\leadsto \frac{\frac{x}{t - z}}{-z} \]
                  6. Applied rewrites59.2%

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

                    \[\leadsto \frac{\color{blue}{\frac{x}{t}}}{-z} \]
                  8. Step-by-step derivation
                    1. lower-/.f6432.3

                      \[\leadsto \frac{\frac{x}{\color{blue}{t}}}{-z} \]
                  9. Applied rewrites32.3%

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

                  if -1.59999999999999989e-123 < z < 5.2e29

                  1. Initial program 89.0%

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

                    \[\leadsto \frac{x}{\color{blue}{t \cdot y}} \]
                  3. Step-by-step derivation
                    1. lower-*.f6439.9

                      \[\leadsto \frac{x}{t \cdot \color{blue}{y}} \]
                  4. Applied rewrites39.9%

                    \[\leadsto \frac{x}{\color{blue}{t \cdot y}} \]
                3. Recombined 3 regimes into one program.
                4. Add Preprocessing

                Alternative 10: 60.4% accurate, 0.7× speedup?

                \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \frac{x}{z \cdot z}\\ \mathbf{if}\;z \leq -1.75 \cdot 10^{+84}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-123}:\\ \;\;\;\;\frac{\frac{x}{t}}{-z}\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+29}:\\ \;\;\;\;\frac{x}{t \cdot y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                (FPCore (x y z t)
                 :precision binary64
                 (let* ((t_1 (/ x (* z z))))
                   (if (<= z -1.75e+84)
                     t_1
                     (if (<= z -1.6e-123)
                       (/ (/ x t) (- z))
                       (if (<= z 5.2e+29) (/ x (* t y)) t_1)))))
                assert(x < y && y < z && z < t);
                double code(double x, double y, double z, double t) {
                	double t_1 = x / (z * z);
                	double tmp;
                	if (z <= -1.75e+84) {
                		tmp = t_1;
                	} else if (z <= -1.6e-123) {
                		tmp = (x / t) / -z;
                	} else if (z <= 5.2e+29) {
                		tmp = x / (t * y);
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                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) :: tmp
                    t_1 = x / (z * z)
                    if (z <= (-1.75d+84)) then
                        tmp = t_1
                    else if (z <= (-1.6d-123)) then
                        tmp = (x / t) / -z
                    else if (z <= 5.2d+29) then
                        tmp = x / (t * y)
                    else
                        tmp = t_1
                    end if
                    code = tmp
                end function
                
                assert x < y && y < z && z < t;
                public static double code(double x, double y, double z, double t) {
                	double t_1 = x / (z * z);
                	double tmp;
                	if (z <= -1.75e+84) {
                		tmp = t_1;
                	} else if (z <= -1.6e-123) {
                		tmp = (x / t) / -z;
                	} else if (z <= 5.2e+29) {
                		tmp = x / (t * y);
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                [x, y, z, t] = sort([x, y, z, t])
                def code(x, y, z, t):
                	t_1 = x / (z * z)
                	tmp = 0
                	if z <= -1.75e+84:
                		tmp = t_1
                	elif z <= -1.6e-123:
                		tmp = (x / t) / -z
                	elif z <= 5.2e+29:
                		tmp = x / (t * y)
                	else:
                		tmp = t_1
                	return tmp
                
                x, y, z, t = sort([x, y, z, t])
                function code(x, y, z, t)
                	t_1 = Float64(x / Float64(z * z))
                	tmp = 0.0
                	if (z <= -1.75e+84)
                		tmp = t_1;
                	elseif (z <= -1.6e-123)
                		tmp = Float64(Float64(x / t) / Float64(-z));
                	elseif (z <= 5.2e+29)
                		tmp = Float64(x / Float64(t * y));
                	else
                		tmp = t_1;
                	end
                	return tmp
                end
                
                x, y, z, t = num2cell(sort([x, y, z, t])){:}
                function tmp_2 = code(x, y, z, t)
                	t_1 = x / (z * z);
                	tmp = 0.0;
                	if (z <= -1.75e+84)
                		tmp = t_1;
                	elseif (z <= -1.6e-123)
                		tmp = (x / t) / -z;
                	elseif (z <= 5.2e+29)
                		tmp = x / (t * y);
                	else
                		tmp = t_1;
                	end
                	tmp_2 = tmp;
                end
                
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.75e+84], t$95$1, If[LessEqual[z, -1.6e-123], N[(N[(x / t), $MachinePrecision] / (-z)), $MachinePrecision], If[LessEqual[z, 5.2e+29], N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
                
                \begin{array}{l}
                [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
                \\
                \begin{array}{l}
                t_1 := \frac{x}{z \cdot z}\\
                \mathbf{if}\;z \leq -1.75 \cdot 10^{+84}:\\
                \;\;\;\;t\_1\\
                
                \mathbf{elif}\;z \leq -1.6 \cdot 10^{-123}:\\
                \;\;\;\;\frac{\frac{x}{t}}{-z}\\
                
                \mathbf{elif}\;z \leq 5.2 \cdot 10^{+29}:\\
                \;\;\;\;\frac{x}{t \cdot y}\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_1\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if z < -1.7499999999999999e84 or 5.2e29 < z

                  1. Initial program 89.0%

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

                    \[\leadsto \frac{x}{\color{blue}{{z}^{2}}} \]
                  3. Step-by-step derivation
                    1. unpow2N/A

                      \[\leadsto \frac{x}{z \cdot \color{blue}{z}} \]
                    2. lower-*.f6439.7

                      \[\leadsto \frac{x}{z \cdot \color{blue}{z}} \]
                  4. Applied rewrites39.7%

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

                  if -1.7499999999999999e84 < z < -1.59999999999999989e-123

                  1. Initial program 89.0%

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{x}{\color{blue}{t - z}}}{y - z} \]
                    10. lift--.f6496.8

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

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

                    \[\leadsto \frac{\frac{x}{t - z}}{\color{blue}{-1 \cdot z}} \]
                  5. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \frac{\frac{x}{t - z}}{\mathsf{neg}\left(z\right)} \]
                    2. lift-neg.f6459.2

                      \[\leadsto \frac{\frac{x}{t - z}}{-z} \]
                  6. Applied rewrites59.2%

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

                    \[\leadsto \frac{\color{blue}{\frac{x}{t}}}{-z} \]
                  8. Step-by-step derivation
                    1. lower-/.f6432.3

                      \[\leadsto \frac{\frac{x}{\color{blue}{t}}}{-z} \]
                  9. Applied rewrites32.3%

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

                  if -1.59999999999999989e-123 < z < 5.2e29

                  1. Initial program 89.0%

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

                    \[\leadsto \frac{x}{\color{blue}{t \cdot y}} \]
                  3. Step-by-step derivation
                    1. lower-*.f6439.9

                      \[\leadsto \frac{x}{t \cdot \color{blue}{y}} \]
                  4. Applied rewrites39.9%

                    \[\leadsto \frac{x}{\color{blue}{t \cdot y}} \]
                3. Recombined 3 regimes into one program.
                4. Add Preprocessing

                Alternative 11: 60.1% accurate, 0.8× speedup?

                \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \begin{array}{l} t_1 := \frac{x}{z \cdot z}\\ \mathbf{if}\;z \leq -1.25 \cdot 10^{-126}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+29}:\\ \;\;\;\;\frac{x}{t \cdot y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                (FPCore (x y z t)
                 :precision binary64
                 (let* ((t_1 (/ x (* z z))))
                   (if (<= z -1.25e-126) t_1 (if (<= z 5.2e+29) (/ x (* t y)) t_1))))
                assert(x < y && y < z && z < t);
                double code(double x, double y, double z, double t) {
                	double t_1 = x / (z * z);
                	double tmp;
                	if (z <= -1.25e-126) {
                		tmp = t_1;
                	} else if (z <= 5.2e+29) {
                		tmp = x / (t * y);
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                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) :: tmp
                    t_1 = x / (z * z)
                    if (z <= (-1.25d-126)) then
                        tmp = t_1
                    else if (z <= 5.2d+29) then
                        tmp = x / (t * y)
                    else
                        tmp = t_1
                    end if
                    code = tmp
                end function
                
                assert x < y && y < z && z < t;
                public static double code(double x, double y, double z, double t) {
                	double t_1 = x / (z * z);
                	double tmp;
                	if (z <= -1.25e-126) {
                		tmp = t_1;
                	} else if (z <= 5.2e+29) {
                		tmp = x / (t * y);
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                [x, y, z, t] = sort([x, y, z, t])
                def code(x, y, z, t):
                	t_1 = x / (z * z)
                	tmp = 0
                	if z <= -1.25e-126:
                		tmp = t_1
                	elif z <= 5.2e+29:
                		tmp = x / (t * y)
                	else:
                		tmp = t_1
                	return tmp
                
                x, y, z, t = sort([x, y, z, t])
                function code(x, y, z, t)
                	t_1 = Float64(x / Float64(z * z))
                	tmp = 0.0
                	if (z <= -1.25e-126)
                		tmp = t_1;
                	elseif (z <= 5.2e+29)
                		tmp = Float64(x / Float64(t * y));
                	else
                		tmp = t_1;
                	end
                	return tmp
                end
                
                x, y, z, t = num2cell(sort([x, y, z, t])){:}
                function tmp_2 = code(x, y, z, t)
                	t_1 = x / (z * z);
                	tmp = 0.0;
                	if (z <= -1.25e-126)
                		tmp = t_1;
                	elseif (z <= 5.2e+29)
                		tmp = x / (t * y);
                	else
                		tmp = t_1;
                	end
                	tmp_2 = tmp;
                end
                
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.25e-126], t$95$1, If[LessEqual[z, 5.2e+29], N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
                
                \begin{array}{l}
                [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
                \\
                \begin{array}{l}
                t_1 := \frac{x}{z \cdot z}\\
                \mathbf{if}\;z \leq -1.25 \cdot 10^{-126}:\\
                \;\;\;\;t\_1\\
                
                \mathbf{elif}\;z \leq 5.2 \cdot 10^{+29}:\\
                \;\;\;\;\frac{x}{t \cdot y}\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_1\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if z < -1.25000000000000001e-126 or 5.2e29 < z

                  1. Initial program 89.0%

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

                    \[\leadsto \frac{x}{\color{blue}{{z}^{2}}} \]
                  3. Step-by-step derivation
                    1. unpow2N/A

                      \[\leadsto \frac{x}{z \cdot \color{blue}{z}} \]
                    2. lower-*.f6439.7

                      \[\leadsto \frac{x}{z \cdot \color{blue}{z}} \]
                  4. Applied rewrites39.7%

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

                  if -1.25000000000000001e-126 < z < 5.2e29

                  1. Initial program 89.0%

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

                    \[\leadsto \frac{x}{\color{blue}{t \cdot y}} \]
                  3. Step-by-step derivation
                    1. lower-*.f6439.9

                      \[\leadsto \frac{x}{t \cdot \color{blue}{y}} \]
                  4. Applied rewrites39.9%

                    \[\leadsto \frac{x}{\color{blue}{t \cdot y}} \]
                3. Recombined 2 regimes into one program.
                4. Add Preprocessing

                Alternative 12: 39.9% accurate, 1.7× speedup?

                \[\begin{array}{l} [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\ \\ \frac{x}{t \cdot y} \end{array} \]
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                (FPCore (x y z t) :precision binary64 (/ x (* t y)))
                assert(x < y && y < z && z < t);
                double code(double x, double y, double z, double t) {
                	return x / (t * y);
                }
                
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                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 = x / (t * y)
                end function
                
                assert x < y && y < z && z < t;
                public static double code(double x, double y, double z, double t) {
                	return x / (t * y);
                }
                
                [x, y, z, t] = sort([x, y, z, t])
                def code(x, y, z, t):
                	return x / (t * y)
                
                x, y, z, t = sort([x, y, z, t])
                function code(x, y, z, t)
                	return Float64(x / Float64(t * y))
                end
                
                x, y, z, t = num2cell(sort([x, y, z, t])){:}
                function tmp = code(x, y, z, t)
                	tmp = x / (t * y);
                end
                
                NOTE: x, y, z, and t should be sorted in increasing order before calling this function.
                code[x_, y_, z_, t_] := N[(x / N[(t * y), $MachinePrecision]), $MachinePrecision]
                
                \begin{array}{l}
                [x, y, z, t] = \mathsf{sort}([x, y, z, t])\\
                \\
                \frac{x}{t \cdot y}
                \end{array}
                
                Derivation
                1. Initial program 89.0%

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

                  \[\leadsto \frac{x}{\color{blue}{t \cdot y}} \]
                3. Step-by-step derivation
                  1. lower-*.f6439.9

                    \[\leadsto \frac{x}{t \cdot \color{blue}{y}} \]
                4. Applied rewrites39.9%

                  \[\leadsto \frac{x}{\color{blue}{t \cdot y}} \]
                5. Add Preprocessing

                Reproduce

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