Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3

Percentage Accurate: 68.2% → 93.0%
Time: 25.2s
Alternatives: 22
Speedup: 0.9×

Specification

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

\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\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 22 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: 68.2% accurate, 1.0× speedup?

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

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

Alternative 1: 93.0% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z}{z - a}\\ t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{if}\;t\_2 \leq -1 \cdot 10^{+252}:\\ \;\;\;\;\mathsf{fma}\left(x, \frac{a}{a - z}, \mathsf{fma}\left(x, t\_1, \frac{t - x}{a - z} \cdot \left(y - z\right)\right)\right)\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+116}:\\ \;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(-1, \frac{z - y}{z - a}, t\_1\right) - \frac{a}{z - a}, \frac{t \cdot \left(z - y\right)}{z - a}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x - t, \frac{1}{z - a} \cdot y, \mathsf{fma}\left(t\_1, t - x, x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ z (- z a))) (t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
   (if (<= t_2 -1e+252)
     (fma x (/ a (- a z)) (fma x t_1 (* (/ (- t x) (- a z)) (- y z))))
     (if (<= t_2 2e+116)
       (fma
        x
        (- (fma -1.0 (/ (- z y) (- z a)) t_1) (/ a (- z a)))
        (/ (* t (- z y)) (- z a)))
       (fma (- x t) (* (/ 1.0 (- z a)) y) (fma t_1 (- t x) x))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = z / (z - a);
	double t_2 = x + (((y - z) * (t - x)) / (a - z));
	double tmp;
	if (t_2 <= -1e+252) {
		tmp = fma(x, (a / (a - z)), fma(x, t_1, (((t - x) / (a - z)) * (y - z))));
	} else if (t_2 <= 2e+116) {
		tmp = fma(x, (fma(-1.0, ((z - y) / (z - a)), t_1) - (a / (z - a))), ((t * (z - y)) / (z - a)));
	} else {
		tmp = fma((x - t), ((1.0 / (z - a)) * y), fma(t_1, (t - x), x));
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = Float64(z / Float64(z - a))
	t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z)))
	tmp = 0.0
	if (t_2 <= -1e+252)
		tmp = fma(x, Float64(a / Float64(a - z)), fma(x, t_1, Float64(Float64(Float64(t - x) / Float64(a - z)) * Float64(y - z))));
	elseif (t_2 <= 2e+116)
		tmp = fma(x, Float64(fma(-1.0, Float64(Float64(z - y) / Float64(z - a)), t_1) - Float64(a / Float64(z - a))), Float64(Float64(t * Float64(z - y)) / Float64(z - a)));
	else
		tmp = fma(Float64(x - t), Float64(Float64(1.0 / Float64(z - a)) * y), fma(t_1, Float64(t - x), x));
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+252], N[(x * N[(a / N[(a - z), $MachinePrecision]), $MachinePrecision] + N[(x * t$95$1 + N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+116], N[(x * N[(N[(-1.0 * N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(a / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - t), $MachinePrecision] * N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] + N[(t$95$1 * N[(t - x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{z}{z - a}\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+252}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{a}{a - z}, \mathsf{fma}\left(x, t\_1, \frac{t - x}{a - z} \cdot \left(y - z\right)\right)\right)\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(-1, \frac{z - y}{z - a}, t\_1\right) - \frac{a}{z - a}, \frac{t \cdot \left(z - y\right)}{z - a}\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{1}{z - a} \cdot y, \mathsf{fma}\left(t\_1, t - x, x\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -1.0000000000000001e252

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites83.2%

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

    if -1.0000000000000001e252 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 2.00000000000000003e116

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites63.4%

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

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

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

    if 2.00000000000000003e116 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z)))

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

Alternative 2: 92.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z}{z - a}\\ t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;\mathsf{fma}\left(x, \frac{a}{a - z}, \mathsf{fma}\left(x, t\_1, \frac{t - x}{a - z} \cdot \left(y - z\right)\right)\right)\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x - t, \frac{1}{z - a} \cdot y, \mathsf{fma}\left(t\_1, t - x, x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ z (- z a))) (t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
   (if (<= t_2 -5e-278)
     (fma x (/ a (- a z)) (fma x t_1 (* (/ (- t x) (- a z)) (- y z))))
     (if (<= t_2 0.0)
       (+ t (* -1.0 (/ (- (* y (- t x)) (* a (- t x))) z)))
       (fma (- x t) (* (/ 1.0 (- z a)) y) (fma t_1 (- t x) x))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = z / (z - a);
	double t_2 = x + (((y - z) * (t - x)) / (a - z));
	double tmp;
	if (t_2 <= -5e-278) {
		tmp = fma(x, (a / (a - z)), fma(x, t_1, (((t - x) / (a - z)) * (y - z))));
	} else if (t_2 <= 0.0) {
		tmp = t + (-1.0 * (((y * (t - x)) - (a * (t - x))) / z));
	} else {
		tmp = fma((x - t), ((1.0 / (z - a)) * y), fma(t_1, (t - x), x));
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = Float64(z / Float64(z - a))
	t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z)))
	tmp = 0.0
	if (t_2 <= -5e-278)
		tmp = fma(x, Float64(a / Float64(a - z)), fma(x, t_1, Float64(Float64(Float64(t - x) / Float64(a - z)) * Float64(y - z))));
	elseif (t_2 <= 0.0)
		tmp = Float64(t + Float64(-1.0 * Float64(Float64(Float64(y * Float64(t - x)) - Float64(a * Float64(t - x))) / z)));
	else
		tmp = fma(Float64(x - t), Float64(Float64(1.0 / Float64(z - a)) * y), fma(t_1, Float64(t - x), x));
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-278], N[(x * N[(a / N[(a - z), $MachinePrecision]), $MachinePrecision] + N[(x * t$95$1 + N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(t + N[(-1.0 * N[(N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] - N[(a * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - t), $MachinePrecision] * N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] + N[(t$95$1 * N[(t - x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{z}{z - a}\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-278}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{a}{a - z}, \mathsf{fma}\left(x, t\_1, \frac{t - x}{a - z} \cdot \left(y - z\right)\right)\right)\\

\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{1}{z - a} \cdot y, \mathsf{fma}\left(t\_1, t - x, x\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -4.99999999999999985e-278

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites83.2%

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

    if -4.99999999999999985e-278 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0

    1. Initial program 68.2%

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

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

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

    if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z)))

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

Alternative 3: 91.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{1}{z - a}\\ t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;\mathsf{fma}\left(x - t, t\_1 \cdot \left(y - z\right), x\right)\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+307}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, \left(t - x\right) \cdot \left(z - y\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y, \mathsf{fma}\left(\frac{z}{z - a}, t - x, x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ 1.0 (- z a))) (t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
   (if (<= t_2 -5e-278)
     (fma (- x t) (* t_1 (- y z)) x)
     (if (<= t_2 0.0)
       (+ t (* -1.0 (/ (- (* y (- t x)) (* a (- t x))) z)))
       (if (<= t_2 2e+307)
         (fma t_1 (* (- t x) (- z y)) x)
         (fma (/ (- t x) (- a z)) y (fma (/ z (- z a)) (- t x) x)))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = 1.0 / (z - a);
	double t_2 = x + (((y - z) * (t - x)) / (a - z));
	double tmp;
	if (t_2 <= -5e-278) {
		tmp = fma((x - t), (t_1 * (y - z)), x);
	} else if (t_2 <= 0.0) {
		tmp = t + (-1.0 * (((y * (t - x)) - (a * (t - x))) / z));
	} else if (t_2 <= 2e+307) {
		tmp = fma(t_1, ((t - x) * (z - y)), x);
	} else {
		tmp = fma(((t - x) / (a - z)), y, fma((z / (z - a)), (t - x), x));
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = Float64(1.0 / Float64(z - a))
	t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z)))
	tmp = 0.0
	if (t_2 <= -5e-278)
		tmp = fma(Float64(x - t), Float64(t_1 * Float64(y - z)), x);
	elseif (t_2 <= 0.0)
		tmp = Float64(t + Float64(-1.0 * Float64(Float64(Float64(y * Float64(t - x)) - Float64(a * Float64(t - x))) / z)));
	elseif (t_2 <= 2e+307)
		tmp = fma(t_1, Float64(Float64(t - x) * Float64(z - y)), x);
	else
		tmp = fma(Float64(Float64(t - x) / Float64(a - z)), y, fma(Float64(z / Float64(z - a)), Float64(t - x), x));
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-278], N[(N[(x - t), $MachinePrecision] * N[(t$95$1 * N[(y - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(t + N[(-1.0 * N[(N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] - N[(a * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+307], N[(t$95$1 * N[(N[(t - x), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * y + N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{1}{z - a}\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-278}:\\
\;\;\;\;\mathsf{fma}\left(x - t, t\_1 \cdot \left(y - z\right), x\right)\\

\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \left(t - x\right) \cdot \left(z - y\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a - z}, y, \mathsf{fma}\left(\frac{z}{z - a}, t - x, x\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -4.99999999999999985e-278

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

    if -4.99999999999999985e-278 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0

    1. Initial program 68.2%

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

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

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

    if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 1.99999999999999997e307

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites68.2%

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

    if 1.99999999999999997e307 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z)))

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites85.5%

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

Alternative 4: 91.0% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(x - t, \frac{1}{z - a} \cdot y, \mathsf{fma}\left(\frac{z}{z - a}, t - x, x\right)\right)\\ t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma (- x t) (* (/ 1.0 (- z a)) y) (fma (/ z (- z a)) (- t x) x)))
        (t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
   (if (<= t_2 -5e-278)
     t_1
     (if (<= t_2 0.0)
       (+ t (* -1.0 (/ (- (* y (- t x)) (* a (- t x))) z)))
       t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma((x - t), ((1.0 / (z - a)) * y), fma((z / (z - a)), (t - x), x));
	double t_2 = x + (((y - z) * (t - x)) / (a - z));
	double tmp;
	if (t_2 <= -5e-278) {
		tmp = t_1;
	} else if (t_2 <= 0.0) {
		tmp = t + (-1.0 * (((y * (t - x)) - (a * (t - x))) / z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(Float64(x - t), Float64(Float64(1.0 / Float64(z - a)) * y), fma(Float64(z / Float64(z - a)), Float64(t - x), x))
	t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z)))
	tmp = 0.0
	if (t_2 <= -5e-278)
		tmp = t_1;
	elseif (t_2 <= 0.0)
		tmp = Float64(t + Float64(-1.0 * Float64(Float64(Float64(y * Float64(t - x)) - Float64(a * Float64(t - x))) / z)));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] + N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-278], t$95$1, If[LessEqual[t$95$2, 0.0], N[(t + N[(-1.0 * N[(N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] - N[(a * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x - t, \frac{1}{z - a} \cdot y, \mathsf{fma}\left(\frac{z}{z - a}, t - x, x\right)\right)\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-278}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -4.99999999999999985e-278 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z)))

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

    if -4.99999999999999985e-278 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0

    1. Initial program 68.2%

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

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

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

Alternative 5: 90.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;\mathsf{fma}\left(x - t, \frac{1}{z - a} \cdot \left(y - z\right), x\right)\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (/ (* (- y z) (- t x)) (- a z)))))
   (if (<= t_1 -5e-278)
     (fma (- x t) (* (/ 1.0 (- z a)) (- y z)) x)
     (if (<= t_1 0.0)
       (+ t (* -1.0 (/ (- (* y (- t x)) (* a (- t x))) z)))
       (fma (/ (- z y) (- z a)) (- t x) x)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = x + (((y - z) * (t - x)) / (a - z));
	double tmp;
	if (t_1 <= -5e-278) {
		tmp = fma((x - t), ((1.0 / (z - a)) * (y - z)), x);
	} else if (t_1 <= 0.0) {
		tmp = t + (-1.0 * (((y * (t - x)) - (a * (t - x))) / z));
	} else {
		tmp = fma(((z - y) / (z - a)), (t - x), x);
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z)))
	tmp = 0.0
	if (t_1 <= -5e-278)
		tmp = fma(Float64(x - t), Float64(Float64(1.0 / Float64(z - a)) * Float64(y - z)), x);
	elseif (t_1 <= 0.0)
		tmp = Float64(t + Float64(-1.0 * Float64(Float64(Float64(y * Float64(t - x)) - Float64(a * Float64(t - x))) / z)));
	else
		tmp = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-278], N[(N[(x - t), $MachinePrecision] * N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(t + N[(-1.0 * N[(N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] - N[(a * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-278}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{1}{z - a} \cdot \left(y - z\right), x\right)\\

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -4.99999999999999985e-278

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

    if -4.99999999999999985e-278 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0

    1. Initial program 68.2%

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

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

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

    if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z)))

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites84.2%

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

Alternative 6: 88.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;\mathsf{fma}\left(x - t, \frac{1}{z - a} \cdot \left(y - z\right), x\right)\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;t + \frac{y \cdot \left(x - t\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (/ (* (- y z) (- t x)) (- a z)))))
   (if (<= t_1 -5e-278)
     (fma (- x t) (* (/ 1.0 (- z a)) (- y z)) x)
     (if (<= t_1 0.0)
       (+ t (/ (* y (- x t)) z))
       (fma (/ (- z y) (- z a)) (- t x) x)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = x + (((y - z) * (t - x)) / (a - z));
	double tmp;
	if (t_1 <= -5e-278) {
		tmp = fma((x - t), ((1.0 / (z - a)) * (y - z)), x);
	} else if (t_1 <= 0.0) {
		tmp = t + ((y * (x - t)) / z);
	} else {
		tmp = fma(((z - y) / (z - a)), (t - x), x);
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z)))
	tmp = 0.0
	if (t_1 <= -5e-278)
		tmp = fma(Float64(x - t), Float64(Float64(1.0 / Float64(z - a)) * Float64(y - z)), x);
	elseif (t_1 <= 0.0)
		tmp = Float64(t + Float64(Float64(y * Float64(x - t)) / z));
	else
		tmp = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-278], N[(N[(x - t), $MachinePrecision] * N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(t + N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-278}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{1}{z - a} \cdot \left(y - z\right), x\right)\\

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t + \frac{y \cdot \left(x - t\right)}{z}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -4.99999999999999985e-278

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

    if -4.99999999999999985e-278 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

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

    if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z)))

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites84.2%

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

Alternative 7: 88.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z - y}{z - a}\\ t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;x + t\_1 \cdot \left(t - x\right)\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;t + \frac{y \cdot \left(x - t\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, t - x, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (- z y) (- z a))) (t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
   (if (<= t_2 -5e-278)
     (+ x (* t_1 (- t x)))
     (if (<= t_2 0.0) (+ t (/ (* y (- x t)) z)) (fma t_1 (- t x) x)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (z - y) / (z - a);
	double t_2 = x + (((y - z) * (t - x)) / (a - z));
	double tmp;
	if (t_2 <= -5e-278) {
		tmp = x + (t_1 * (t - x));
	} else if (t_2 <= 0.0) {
		tmp = t + ((y * (x - t)) / z);
	} else {
		tmp = fma(t_1, (t - x), x);
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = Float64(Float64(z - y) / Float64(z - a))
	t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z)))
	tmp = 0.0
	if (t_2 <= -5e-278)
		tmp = Float64(x + Float64(t_1 * Float64(t - x)));
	elseif (t_2 <= 0.0)
		tmp = Float64(t + Float64(Float64(y * Float64(x - t)) / z));
	else
		tmp = fma(t_1, Float64(t - x), x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-278], N[(x + N[(t$95$1 * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(t + N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t + \frac{y \cdot \left(x - t\right)}{z}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t - x, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -4.99999999999999985e-278

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites84.2%

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

    if -4.99999999999999985e-278 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

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

    if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z)))

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites84.2%

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

Alternative 8: 88.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\ t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-278}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;t + \frac{y \cdot \left(x - t\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma (/ (- z y) (- z a)) (- t x) x))
        (t_2 (+ x (/ (* (- y z) (- t x)) (- a z)))))
   (if (<= t_2 -5e-278) t_1 (if (<= t_2 0.0) (+ t (/ (* y (- x t)) z)) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma(((z - y) / (z - a)), (t - x), x);
	double t_2 = x + (((y - z) * (t - x)) / (a - z));
	double tmp;
	if (t_2 <= -5e-278) {
		tmp = t_1;
	} else if (t_2 <= 0.0) {
		tmp = t + ((y * (x - t)) / z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x)
	t_2 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z)))
	tmp = 0.0
	if (t_2 <= -5e-278)
		tmp = t_1;
	elseif (t_2 <= 0.0)
		tmp = Float64(t + Float64(Float64(y * Float64(x - t)) / z));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-278], t$95$1, If[LessEqual[t$95$2, 0.0], N[(t + N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
t_2 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-278}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t + \frac{y \cdot \left(x - t\right)}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -4.99999999999999985e-278 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z)))

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites84.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)} \]

    if -4.99999999999999985e-278 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

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

Alternative 9: 81.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+209}:\\ \;\;\;\;t \cdot \left(\frac{1}{z - a} \cdot \left(z - y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t - x}{z - a}, z - y, x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -1.15e+209)
   (* t (* (/ 1.0 (- z a)) (- z y)))
   (fma (/ (- t x) (- z a)) (- z y) x)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -1.15e+209) {
		tmp = t * ((1.0 / (z - a)) * (z - y));
	} else {
		tmp = fma(((t - x) / (z - a)), (z - y), x);
	}
	return tmp;
}
function code(x, y, z, t, a)
	tmp = 0.0
	if (z <= -1.15e+209)
		tmp = Float64(t * Float64(Float64(1.0 / Float64(z - a)) * Float64(z - y)));
	else
		tmp = fma(Float64(Float64(t - x) / Float64(z - a)), Float64(z - y), x);
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.15e+209], N[(t * N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+209}:\\
\;\;\;\;t \cdot \left(\frac{1}{z - a} \cdot \left(z - y\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{z - a}, z - y, x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.15000000000000005e209

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites80.2%

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{z}{z - a} - \frac{y}{z - a}\right)} \]
    4. Applied rewrites50.8%

      \[\leadsto \color{blue}{t \cdot \left(\frac{z}{z - a} - \frac{y}{z - a}\right)} \]
    5. Applied rewrites50.7%

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

    if -1.15000000000000005e209 < z

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites80.2%

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

Alternative 10: 72.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(\frac{t}{z - a}, z - y, x\right)\\ \mathbf{if}\;a \leq -1.7 \cdot 10^{+79}:\\ \;\;\;\;x + \frac{y}{a} \cdot \left(t - x\right)\\ \mathbf{elif}\;a \leq -1.8 \cdot 10^{-42}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 4 \cdot 10^{-36}:\\ \;\;\;\;t + \frac{y \cdot \left(x - t\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma (/ t (- z a)) (- z y) x)))
   (if (<= a -1.7e+79)
     (+ x (* (/ y a) (- t x)))
     (if (<= a -1.8e-42)
       t_1
       (if (<= a 4e-36) (+ t (/ (* y (- x t)) z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma((t / (z - a)), (z - y), x);
	double tmp;
	if (a <= -1.7e+79) {
		tmp = x + ((y / a) * (t - x));
	} else if (a <= -1.8e-42) {
		tmp = t_1;
	} else if (a <= 4e-36) {
		tmp = t + ((y * (x - t)) / z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(Float64(t / Float64(z - a)), Float64(z - y), x)
	tmp = 0.0
	if (a <= -1.7e+79)
		tmp = Float64(x + Float64(Float64(y / a) * Float64(t - x)));
	elseif (a <= -1.8e-42)
		tmp = t_1;
	elseif (a <= 4e-36)
		tmp = Float64(t + Float64(Float64(y * Float64(x - t)) / z));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.7e+79], N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -1.8e-42], t$95$1, If[LessEqual[a, 4e-36], N[(t + N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t}{z - a}, z - y, x\right)\\
\mathbf{if}\;a \leq -1.7 \cdot 10^{+79}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - x\right)\\

\mathbf{elif}\;a \leq -1.8 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 4 \cdot 10^{-36}:\\
\;\;\;\;t + \frac{y \cdot \left(x - t\right)}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.70000000000000016e79

    1. Initial program 68.2%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(t - x\right)}{a}} \]
    3. Applied rewrites44.3%

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(t - x\right)}{a}} \]
    4. Applied rewrites49.2%

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

    if -1.70000000000000016e79 < a < -1.8000000000000001e-42 or 3.9999999999999998e-36 < a

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites80.2%

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

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

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{t}}{z - a}, z - y, x\right) \]

    if -1.8000000000000001e-42 < a < 3.9999999999999998e-36

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

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

Alternative 11: 67.5% accurate, 0.9× speedup?

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

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + ((y / a) * (t - x))
    if (a <= (-1.4d+68)) then
        tmp = t_1
    else if (a <= 4.5d-36) then
        tmp = t + ((y * (x - t)) / z)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = x + ((y / a) * (t - x));
	double tmp;
	if (a <= -1.4e+68) {
		tmp = t_1;
	} else if (a <= 4.5e-36) {
		tmp = t + ((y * (x - t)) / z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x + ((y / a) * (t - x))
	tmp = 0
	if a <= -1.4e+68:
		tmp = t_1
	elif a <= 4.5e-36:
		tmp = t + ((y * (x - t)) / z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(Float64(y / a) * Float64(t - x)))
	tmp = 0.0
	if (a <= -1.4e+68)
		tmp = t_1;
	elseif (a <= 4.5e-36)
		tmp = Float64(t + Float64(Float64(y * Float64(x - t)) / z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + ((y / a) * (t - x));
	tmp = 0.0;
	if (a <= -1.4e+68)
		tmp = t_1;
	elseif (a <= 4.5e-36)
		tmp = t + ((y * (x - t)) / z);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.4e+68], t$95$1, If[LessEqual[a, 4.5e-36], N[(t + N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + \frac{y}{a} \cdot \left(t - x\right)\\
\mathbf{if}\;a \leq -1.4 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 4.5 \cdot 10^{-36}:\\
\;\;\;\;t + \frac{y \cdot \left(x - t\right)}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.4e68 or 4.50000000000000024e-36 < a

    1. Initial program 68.2%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(t - x\right)}{a}} \]
    3. Applied rewrites44.3%

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(t - x\right)}{a}} \]
    4. Applied rewrites49.2%

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

    if -1.4e68 < a < 4.50000000000000024e-36

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

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

Alternative 12: 59.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.7 \cdot 10^{+189}:\\ \;\;\;\;x \cdot \left(1 + \frac{z}{a - z}\right)\\ \mathbf{elif}\;a \leq -3 \cdot 10^{+25}:\\ \;\;\;\;\frac{y}{z - a} \cdot \left(x - t\right)\\ \mathbf{elif}\;a \leq -2.15 \cdot 10^{-9}:\\ \;\;\;\;\frac{\left(-x\right) \cdot a}{z - a}\\ \mathbf{elif}\;a \leq 2.2 \cdot 10^{+18}:\\ \;\;\;\;t + \frac{y \cdot \left(x - t\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{t \cdot y}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -1.7e+189)
   (* x (+ 1.0 (/ z (- a z))))
   (if (<= a -3e+25)
     (* (/ y (- z a)) (- x t))
     (if (<= a -2.15e-9)
       (/ (* (- x) a) (- z a))
       (if (<= a 2.2e+18) (+ t (/ (* y (- x t)) z)) (+ x (/ (* t y) a)))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -1.7e+189) {
		tmp = x * (1.0 + (z / (a - z)));
	} else if (a <= -3e+25) {
		tmp = (y / (z - a)) * (x - t);
	} else if (a <= -2.15e-9) {
		tmp = (-x * a) / (z - a);
	} else if (a <= 2.2e+18) {
		tmp = t + ((y * (x - t)) / z);
	} else {
		tmp = x + ((t * y) / a);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: tmp
    if (a <= (-1.7d+189)) then
        tmp = x * (1.0d0 + (z / (a - z)))
    else if (a <= (-3d+25)) then
        tmp = (y / (z - a)) * (x - t)
    else if (a <= (-2.15d-9)) then
        tmp = (-x * a) / (z - a)
    else if (a <= 2.2d+18) then
        tmp = t + ((y * (x - t)) / z)
    else
        tmp = x + ((t * y) / a)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -1.7e+189) {
		tmp = x * (1.0 + (z / (a - z)));
	} else if (a <= -3e+25) {
		tmp = (y / (z - a)) * (x - t);
	} else if (a <= -2.15e-9) {
		tmp = (-x * a) / (z - a);
	} else if (a <= 2.2e+18) {
		tmp = t + ((y * (x - t)) / z);
	} else {
		tmp = x + ((t * y) / a);
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= -1.7e+189:
		tmp = x * (1.0 + (z / (a - z)))
	elif a <= -3e+25:
		tmp = (y / (z - a)) * (x - t)
	elif a <= -2.15e-9:
		tmp = (-x * a) / (z - a)
	elif a <= 2.2e+18:
		tmp = t + ((y * (x - t)) / z)
	else:
		tmp = x + ((t * y) / a)
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -1.7e+189)
		tmp = Float64(x * Float64(1.0 + Float64(z / Float64(a - z))));
	elseif (a <= -3e+25)
		tmp = Float64(Float64(y / Float64(z - a)) * Float64(x - t));
	elseif (a <= -2.15e-9)
		tmp = Float64(Float64(Float64(-x) * a) / Float64(z - a));
	elseif (a <= 2.2e+18)
		tmp = Float64(t + Float64(Float64(y * Float64(x - t)) / z));
	else
		tmp = Float64(x + Float64(Float64(t * y) / a));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (a <= -1.7e+189)
		tmp = x * (1.0 + (z / (a - z)));
	elseif (a <= -3e+25)
		tmp = (y / (z - a)) * (x - t);
	elseif (a <= -2.15e-9)
		tmp = (-x * a) / (z - a);
	elseif (a <= 2.2e+18)
		tmp = t + ((y * (x - t)) / z);
	else
		tmp = x + ((t * y) / a);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.7e+189], N[(x * N[(1.0 + N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -3e+25], N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -2.15e-9], N[(N[((-x) * a), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.2e+18], N[(t + N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.7 \cdot 10^{+189}:\\
\;\;\;\;x \cdot \left(1 + \frac{z}{a - z}\right)\\

\mathbf{elif}\;a \leq -3 \cdot 10^{+25}:\\
\;\;\;\;\frac{y}{z - a} \cdot \left(x - t\right)\\

\mathbf{elif}\;a \leq -2.15 \cdot 10^{-9}:\\
\;\;\;\;\frac{\left(-x\right) \cdot a}{z - a}\\

\mathbf{elif}\;a \leq 2.2 \cdot 10^{+18}:\\
\;\;\;\;t + \frac{y \cdot \left(x - t\right)}{z}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if a < -1.69999999999999992e189

    1. Initial program 68.2%

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(1 + \frac{z}{a - z}\right)} \]
    5. Applied rewrites25.5%

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

    if -1.69999999999999992e189 < a < -3.00000000000000006e25

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

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

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

    if -3.00000000000000006e25 < a < -2.14999999999999981e-9

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites63.4%

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(a \cdot x\right)}}{z - a} \]
    4. Applied rewrites21.3%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(a \cdot x\right)}}{z - a} \]
    5. Applied rewrites21.3%

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

    if -2.14999999999999981e-9 < a < 2.2e18

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

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

    if 2.2e18 < a

    1. Initial program 68.2%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(t - x\right)}{a}} \]
    3. Applied rewrites44.3%

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

      \[\leadsto x + \frac{t \cdot y}{a} \]
    5. Applied rewrites38.1%

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

Alternative 13: 56.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y}{z - a} \cdot \left(x - t\right)\\ \mathbf{if}\;y \leq -1.05 \cdot 10^{-60}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{-164}:\\ \;\;\;\;t \cdot \frac{z}{z - a}\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+24}:\\ \;\;\;\;\frac{t}{z - a} \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* (/ y (- z a)) (- x t))))
   (if (<= y -1.05e-60)
     t_1
     (if (<= y 8.5e-164)
       (* t (/ z (- z a)))
       (if (<= y 4.8e+24) (* (/ t (- z a)) (- z y)) t_1)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (y / (z - a)) * (x - t);
	double tmp;
	if (y <= -1.05e-60) {
		tmp = t_1;
	} else if (y <= 8.5e-164) {
		tmp = t * (z / (z - a));
	} else if (y <= 4.8e+24) {
		tmp = (t / (z - a)) * (z - y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (y / (z - a)) * (x - t)
    if (y <= (-1.05d-60)) then
        tmp = t_1
    else if (y <= 8.5d-164) then
        tmp = t * (z / (z - a))
    else if (y <= 4.8d+24) then
        tmp = (t / (z - a)) * (z - y)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (y / (z - a)) * (x - t);
	double tmp;
	if (y <= -1.05e-60) {
		tmp = t_1;
	} else if (y <= 8.5e-164) {
		tmp = t * (z / (z - a));
	} else if (y <= 4.8e+24) {
		tmp = (t / (z - a)) * (z - y);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (y / (z - a)) * (x - t)
	tmp = 0
	if y <= -1.05e-60:
		tmp = t_1
	elif y <= 8.5e-164:
		tmp = t * (z / (z - a))
	elif y <= 4.8e+24:
		tmp = (t / (z - a)) * (z - y)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(y / Float64(z - a)) * Float64(x - t))
	tmp = 0.0
	if (y <= -1.05e-60)
		tmp = t_1;
	elseif (y <= 8.5e-164)
		tmp = Float64(t * Float64(z / Float64(z - a)));
	elseif (y <= 4.8e+24)
		tmp = Float64(Float64(t / Float64(z - a)) * Float64(z - y));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (y / (z - a)) * (x - t);
	tmp = 0.0;
	if (y <= -1.05e-60)
		tmp = t_1;
	elseif (y <= 8.5e-164)
		tmp = t * (z / (z - a));
	elseif (y <= 4.8e+24)
		tmp = (t / (z - a)) * (z - y);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.05e-60], t$95$1, If[LessEqual[y, 8.5e-164], N[(t * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+24], N[(N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{y}{z - a} \cdot \left(x - t\right)\\
\mathbf{if}\;y \leq -1.05 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 8.5 \cdot 10^{-164}:\\
\;\;\;\;t \cdot \frac{z}{z - a}\\

\mathbf{elif}\;y \leq 4.8 \cdot 10^{+24}:\\
\;\;\;\;\frac{t}{z - a} \cdot \left(z - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.04999999999999996e-60 or 4.8000000000000001e24 < y

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

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

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

    if -1.04999999999999996e-60 < y < 8.50000000000000035e-164

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites80.2%

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{z}{z - a} - \frac{y}{z - a}\right)} \]
    4. Applied rewrites50.8%

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

      \[\leadsto t \cdot \frac{z}{\color{blue}{z - a}} \]
    6. Applied rewrites29.0%

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

    if 8.50000000000000035e-164 < y < 4.8000000000000001e24

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites80.2%

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{z}{z - a} - \frac{y}{z - a}\right)} \]
    4. Applied rewrites50.8%

      \[\leadsto \color{blue}{t \cdot \left(\frac{z}{z - a} - \frac{y}{z - a}\right)} \]
    5. Applied rewrites45.4%

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

Alternative 14: 55.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y}{z - a} \cdot \left(x - t\right)\\ \mathbf{if}\;y \leq -1.05 \cdot 10^{-60}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{-54}:\\ \;\;\;\;t \cdot \frac{z}{z - a}\\ \mathbf{elif}\;y \leq 3.15 \cdot 10^{+25}:\\ \;\;\;\;\frac{t \cdot \left(y - z\right)}{a - z}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* (/ y (- z a)) (- x t))))
   (if (<= y -1.05e-60)
     t_1
     (if (<= y 8.2e-54)
       (* t (/ z (- z a)))
       (if (<= y 3.15e+25) (/ (* t (- y z)) (- a z)) t_1)))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (y / (z - a)) * (x - t);
	double tmp;
	if (y <= -1.05e-60) {
		tmp = t_1;
	} else if (y <= 8.2e-54) {
		tmp = t * (z / (z - a));
	} else if (y <= 3.15e+25) {
		tmp = (t * (y - z)) / (a - z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (y / (z - a)) * (x - t)
    if (y <= (-1.05d-60)) then
        tmp = t_1
    else if (y <= 8.2d-54) then
        tmp = t * (z / (z - a))
    else if (y <= 3.15d+25) then
        tmp = (t * (y - z)) / (a - z)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (y / (z - a)) * (x - t);
	double tmp;
	if (y <= -1.05e-60) {
		tmp = t_1;
	} else if (y <= 8.2e-54) {
		tmp = t * (z / (z - a));
	} else if (y <= 3.15e+25) {
		tmp = (t * (y - z)) / (a - z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (y / (z - a)) * (x - t)
	tmp = 0
	if y <= -1.05e-60:
		tmp = t_1
	elif y <= 8.2e-54:
		tmp = t * (z / (z - a))
	elif y <= 3.15e+25:
		tmp = (t * (y - z)) / (a - z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(y / Float64(z - a)) * Float64(x - t))
	tmp = 0.0
	if (y <= -1.05e-60)
		tmp = t_1;
	elseif (y <= 8.2e-54)
		tmp = Float64(t * Float64(z / Float64(z - a)));
	elseif (y <= 3.15e+25)
		tmp = Float64(Float64(t * Float64(y - z)) / Float64(a - z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (y / (z - a)) * (x - t);
	tmp = 0.0;
	if (y <= -1.05e-60)
		tmp = t_1;
	elseif (y <= 8.2e-54)
		tmp = t * (z / (z - a));
	elseif (y <= 3.15e+25)
		tmp = (t * (y - z)) / (a - z);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.05e-60], t$95$1, If[LessEqual[y, 8.2e-54], N[(t * N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.15e+25], N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{y}{z - a} \cdot \left(x - t\right)\\
\mathbf{if}\;y \leq -1.05 \cdot 10^{-60}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 8.2 \cdot 10^{-54}:\\
\;\;\;\;t \cdot \frac{z}{z - a}\\

\mathbf{elif}\;y \leq 3.15 \cdot 10^{+25}:\\
\;\;\;\;\frac{t \cdot \left(y - z\right)}{a - z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.04999999999999996e-60 or 3.14999999999999987e25 < y

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

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

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

    if -1.04999999999999996e-60 < y < 8.2000000000000001e-54

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites80.2%

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{z}{z - a} - \frac{y}{z - a}\right)} \]
    4. Applied rewrites50.8%

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

      \[\leadsto t \cdot \frac{z}{\color{blue}{z - a}} \]
    6. Applied rewrites29.0%

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

    if 8.2000000000000001e-54 < y < 3.14999999999999987e25

    1. Initial program 68.2%

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

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

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

Alternative 15: 52.4% accurate, 1.0× speedup?

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

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + ((t * y) / a)
    if (a <= (-3.9d+110)) then
        tmp = t_1
    else if (a <= 1.8d+18) then
        tmp = t * (1.0d0 - (y / z))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = x + ((t * y) / a);
	double tmp;
	if (a <= -3.9e+110) {
		tmp = t_1;
	} else if (a <= 1.8e+18) {
		tmp = t * (1.0 - (y / z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x + ((t * y) / a)
	tmp = 0
	if a <= -3.9e+110:
		tmp = t_1
	elif a <= 1.8e+18:
		tmp = t * (1.0 - (y / z))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(Float64(t * y) / a))
	tmp = 0.0
	if (a <= -3.9e+110)
		tmp = t_1;
	elseif (a <= 1.8e+18)
		tmp = Float64(t * Float64(1.0 - Float64(y / z)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + ((t * y) / a);
	tmp = 0.0;
	if (a <= -3.9e+110)
		tmp = t_1;
	elseif (a <= 1.8e+18)
		tmp = t * (1.0 - (y / z));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.9e+110], t$95$1, If[LessEqual[a, 1.8e+18], N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + \frac{t \cdot y}{a}\\
\mathbf{if}\;a \leq -3.9 \cdot 10^{+110}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 1.8 \cdot 10^{+18}:\\
\;\;\;\;t \cdot \left(1 - \frac{y}{z}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.9000000000000003e110 or 1.8e18 < a

    1. Initial program 68.2%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(t - x\right)}{a}} \]
    3. Applied rewrites44.3%

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

      \[\leadsto x + \frac{t \cdot y}{a} \]
    5. Applied rewrites38.1%

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

    if -3.9000000000000003e110 < a < 1.8e18

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites80.2%

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{z}{z - a} - \frac{y}{z - a}\right)} \]
    4. Applied rewrites50.8%

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

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

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

Alternative 16: 45.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -1.3 \cdot 10^{+110}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;a \leq 1.55 \cdot 10^{+40}:\\ \;\;\;\;t \cdot \left(1 - \frac{y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -1.3e+110)
   (+ x t)
   (if (<= a 1.55e+40) (* t (- 1.0 (/ y z))) (+ x t))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -1.3e+110) {
		tmp = x + t;
	} else if (a <= 1.55e+40) {
		tmp = t * (1.0 - (y / z));
	} else {
		tmp = x + t;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: tmp
    if (a <= (-1.3d+110)) then
        tmp = x + t
    else if (a <= 1.55d+40) then
        tmp = t * (1.0d0 - (y / z))
    else
        tmp = x + t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -1.3e+110) {
		tmp = x + t;
	} else if (a <= 1.55e+40) {
		tmp = t * (1.0 - (y / z));
	} else {
		tmp = x + t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= -1.3e+110:
		tmp = x + t
	elif a <= 1.55e+40:
		tmp = t * (1.0 - (y / z))
	else:
		tmp = x + t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -1.3e+110)
		tmp = Float64(x + t);
	elseif (a <= 1.55e+40)
		tmp = Float64(t * Float64(1.0 - Float64(y / z)));
	else
		tmp = Float64(x + t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (a <= -1.3e+110)
		tmp = x + t;
	elseif (a <= 1.55e+40)
		tmp = t * (1.0 - (y / z));
	else
		tmp = x + t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.3e+110], N[(x + t), $MachinePrecision], If[LessEqual[a, 1.55e+40], N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.3 \cdot 10^{+110}:\\
\;\;\;\;x + t\\

\mathbf{elif}\;a \leq 1.55 \cdot 10^{+40}:\\
\;\;\;\;t \cdot \left(1 - \frac{y}{z}\right)\\

\mathbf{else}:\\
\;\;\;\;x + t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.3e110 or 1.5499999999999999e40 < a

    1. Initial program 68.2%

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

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    3. Applied rewrites19.1%

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    4. Taylor expanded in x around 0

      \[\leadsto x + t \]
    5. Applied rewrites34.1%

      \[\leadsto x + t \]

    if -1.3e110 < a < 1.5499999999999999e40

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites80.2%

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{z}{z - a} - \frac{y}{z - a}\right)} \]
    4. Applied rewrites50.8%

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

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

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

Alternative 17: 43.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \frac{x - t}{z}\\ \mathbf{if}\;y \leq -8.6 \cdot 10^{+27}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 7.8 \cdot 10^{+33}:\\ \;\;\;\;x + t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* y (/ (- x t) z))))
   (if (<= y -8.6e+27) t_1 (if (<= y 7.8e+33) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = y * ((x - t) / z);
	double tmp;
	if (y <= -8.6e+27) {
		tmp = t_1;
	} else if (y <= 7.8e+33) {
		tmp = x + t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = y * ((x - t) / z)
    if (y <= (-8.6d+27)) then
        tmp = t_1
    else if (y <= 7.8d+33) then
        tmp = x + t
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = y * ((x - t) / z);
	double tmp;
	if (y <= -8.6e+27) {
		tmp = t_1;
	} else if (y <= 7.8e+33) {
		tmp = x + t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = y * ((x - t) / z)
	tmp = 0
	if y <= -8.6e+27:
		tmp = t_1
	elif y <= 7.8e+33:
		tmp = x + t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(y * Float64(Float64(x - t) / z))
	tmp = 0.0
	if (y <= -8.6e+27)
		tmp = t_1;
	elseif (y <= 7.8e+33)
		tmp = Float64(x + t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = y * ((x - t) / z);
	tmp = 0.0;
	if (y <= -8.6e+27)
		tmp = t_1;
	elseif (y <= 7.8e+33)
		tmp = x + t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.6e+27], t$95$1, If[LessEqual[y, 7.8e+33], N[(x + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot \frac{x - t}{z}\\
\mathbf{if}\;y \leq -8.6 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 7.8 \cdot 10^{+33}:\\
\;\;\;\;x + t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.60000000000000017e27 or 7.8000000000000004e33 < y

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

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

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

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

    if -8.60000000000000017e27 < y < 7.8000000000000004e33

    1. Initial program 68.2%

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

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    3. Applied rewrites19.1%

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    4. Taylor expanded in x around 0

      \[\leadsto x + t \]
    5. Applied rewrites34.1%

      \[\leadsto x + t \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 18: 41.3% accurate, 1.0× speedup?

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

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (y * (x - t)) / z
    if (y <= (-1.15d+28)) then
        tmp = t_1
    else if (y <= 7.8d+33) then
        tmp = x + t
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (y * (x - t)) / z;
	double tmp;
	if (y <= -1.15e+28) {
		tmp = t_1;
	} else if (y <= 7.8e+33) {
		tmp = x + t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (y * (x - t)) / z
	tmp = 0
	if y <= -1.15e+28:
		tmp = t_1
	elif y <= 7.8e+33:
		tmp = x + t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(y * Float64(x - t)) / z)
	tmp = 0.0
	if (y <= -1.15e+28)
		tmp = t_1;
	elseif (y <= 7.8e+33)
		tmp = Float64(x + t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (y * (x - t)) / z;
	tmp = 0.0;
	if (y <= -1.15e+28)
		tmp = t_1;
	elseif (y <= 7.8e+33)
		tmp = x + t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[y, -1.15e+28], t$95$1, If[LessEqual[y, 7.8e+33], N[(x + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(x - t\right)}{z}\\
\mathbf{if}\;y \leq -1.15 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 7.8 \cdot 10^{+33}:\\
\;\;\;\;x + t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.14999999999999992e28 or 7.8000000000000004e33 < y

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

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

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

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

    if -1.14999999999999992e28 < y < 7.8000000000000004e33

    1. Initial program 68.2%

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

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    3. Applied rewrites19.1%

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    4. Taylor expanded in x around 0

      \[\leadsto x + t \]
    5. Applied rewrites34.1%

      \[\leadsto x + t \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 19: 39.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x \cdot y}{z - a}\\ \mathbf{if}\;y \leq -4.6 \cdot 10^{+28}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{+45}:\\ \;\;\;\;x + t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (* x y) (- z a))))
   (if (<= y -4.6e+28) t_1 (if (<= y 2.7e+45) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) / (z - a);
	double tmp;
	if (y <= -4.6e+28) {
		tmp = t_1;
	} else if (y <= 2.7e+45) {
		tmp = x + t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (x * y) / (z - a)
    if (y <= (-4.6d+28)) then
        tmp = t_1
    else if (y <= 2.7d+45) then
        tmp = x + t
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (x * y) / (z - a);
	double tmp;
	if (y <= -4.6e+28) {
		tmp = t_1;
	} else if (y <= 2.7e+45) {
		tmp = x + t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (x * y) / (z - a)
	tmp = 0
	if y <= -4.6e+28:
		tmp = t_1
	elif y <= 2.7e+45:
		tmp = x + t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x * y) / Float64(z - a))
	tmp = 0.0
	if (y <= -4.6e+28)
		tmp = t_1;
	elseif (y <= 2.7e+45)
		tmp = Float64(x + t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (x * y) / (z - a);
	tmp = 0.0;
	if (y <= -4.6e+28)
		tmp = t_1;
	elseif (y <= 2.7e+45)
		tmp = x + t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.6e+28], t$95$1, If[LessEqual[y, 2.7e+45], N[(x + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{z - a}\\
\mathbf{if}\;y \leq -4.6 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 2.7 \cdot 10^{+45}:\\
\;\;\;\;x + t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.59999999999999968e28 or 2.69999999999999984e45 < y

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites88.3%

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

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

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{z - a}} \]
    6. Applied rewrites21.9%

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

    if -4.59999999999999968e28 < y < 2.69999999999999984e45

    1. Initial program 68.2%

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

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    3. Applied rewrites19.1%

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    4. Taylor expanded in x around 0

      \[\leadsto x + t \]
    5. Applied rewrites34.1%

      \[\leadsto x + t \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 20: 37.2% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -5.7 \cdot 10^{-42}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;a \leq 1.85 \cdot 10^{+38}:\\ \;\;\;\;t \cdot 1\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= a -5.7e-42) (+ x t) (if (<= a 1.85e+38) (* t 1.0) (+ x t))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -5.7e-42) {
		tmp = x + t;
	} else if (a <= 1.85e+38) {
		tmp = t * 1.0;
	} else {
		tmp = x + t;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: tmp
    if (a <= (-5.7d-42)) then
        tmp = x + t
    else if (a <= 1.85d+38) then
        tmp = t * 1.0d0
    else
        tmp = x + t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (a <= -5.7e-42) {
		tmp = x + t;
	} else if (a <= 1.85e+38) {
		tmp = t * 1.0;
	} else {
		tmp = x + t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if a <= -5.7e-42:
		tmp = x + t
	elif a <= 1.85e+38:
		tmp = t * 1.0
	else:
		tmp = x + t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (a <= -5.7e-42)
		tmp = Float64(x + t);
	elseif (a <= 1.85e+38)
		tmp = Float64(t * 1.0);
	else
		tmp = Float64(x + t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (a <= -5.7e-42)
		tmp = x + t;
	elseif (a <= 1.85e+38)
		tmp = t * 1.0;
	else
		tmp = x + t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.7e-42], N[(x + t), $MachinePrecision], If[LessEqual[a, 1.85e+38], N[(t * 1.0), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.7 \cdot 10^{-42}:\\
\;\;\;\;x + t\\

\mathbf{elif}\;a \leq 1.85 \cdot 10^{+38}:\\
\;\;\;\;t \cdot 1\\

\mathbf{else}:\\
\;\;\;\;x + t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -5.6999999999999999e-42 or 1.8500000000000001e38 < a

    1. Initial program 68.2%

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

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    3. Applied rewrites19.1%

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    4. Taylor expanded in x around 0

      \[\leadsto x + t \]
    5. Applied rewrites34.1%

      \[\leadsto x + t \]

    if -5.6999999999999999e-42 < a < 1.8500000000000001e38

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites80.2%

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{z}{z - a} - \frac{y}{z - a}\right)} \]
    4. Applied rewrites50.8%

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

      \[\leadsto t \cdot 1 \]
    6. Applied rewrites24.8%

      \[\leadsto t \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 21: 37.1% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{+124}:\\ \;\;\;\;t \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= y -4.2e+124) (* t (/ y a)) (+ x t)))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (y <= -4.2e+124) {
		tmp = t * (y / a);
	} else {
		tmp = x + t;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    real(8) :: tmp
    if (y <= (-4.2d+124)) then
        tmp = t * (y / a)
    else
        tmp = x + t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (y <= -4.2e+124) {
		tmp = t * (y / a);
	} else {
		tmp = x + t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if y <= -4.2e+124:
		tmp = t * (y / a)
	else:
		tmp = x + t
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (y <= -4.2e+124)
		tmp = Float64(t * Float64(y / a));
	else
		tmp = Float64(x + t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (y <= -4.2e+124)
		tmp = t * (y / a);
	else
		tmp = x + t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -4.2e+124], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+124}:\\
\;\;\;\;t \cdot \frac{y}{a}\\

\mathbf{else}:\\
\;\;\;\;x + t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.20000000000000023e124

    1. Initial program 68.2%

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \]
    2. Applied rewrites80.2%

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{z}{z - a} - \frac{y}{z - a}\right)} \]
    4. Applied rewrites50.8%

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

      \[\leadsto t \cdot \frac{y}{\color{blue}{a}} \]
    6. Applied rewrites19.0%

      \[\leadsto t \cdot \frac{y}{\color{blue}{a}} \]

    if -4.20000000000000023e124 < y

    1. Initial program 68.2%

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

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    3. Applied rewrites19.1%

      \[\leadsto x + \color{blue}{\left(t - x\right)} \]
    4. Taylor expanded in x around 0

      \[\leadsto x + t \]
    5. Applied rewrites34.1%

      \[\leadsto x + t \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 22: 34.1% accurate, 4.8× speedup?

\[\begin{array}{l} \\ x + t \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x t))
double code(double x, double y, double z, double t, double a) {
	return x + t;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t, a)
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), intent (in) :: a
    code = x + t
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + t;
}
def code(x, y, z, t, a):
	return x + t
function code(x, y, z, t, a)
	return Float64(x + t)
end
function tmp = code(x, y, z, t, a)
	tmp = x + t;
end
code[x_, y_, z_, t_, a_] := N[(x + t), $MachinePrecision]
\begin{array}{l}

\\
x + t
\end{array}
Derivation
  1. Initial program 68.2%

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

    \[\leadsto x + \color{blue}{\left(t - x\right)} \]
  3. Applied rewrites19.1%

    \[\leadsto x + \color{blue}{\left(t - x\right)} \]
  4. Taylor expanded in x around 0

    \[\leadsto x + t \]
  5. Applied rewrites34.1%

    \[\leadsto x + t \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2025153 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
  :precision binary64
  (+ x (/ (* (- y z) (- t x)) (- a z))))