Numeric.Signal:interpolate from hsignal-0.2.7.1

Percentage Accurate: 80.1% → 92.7%
Time: 16.3s
Alternatives: 18
Speedup: 0.3×

Specification

?
\[\begin{array}{l} \\ x + \left(y - z\right) \cdot \frac{t - x}{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(y - z) * Float64(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[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

\[\begin{array}{l} \\ x + \left(y - z\right) \cdot \frac{t - x}{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(y - z) * Float64(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[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 92.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z - y}{z - a}\\ t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-86}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{z - a} \cdot \left(z - y\right), t - x, x\right)\\ \mathbf{elif}\;t\_2 \leq 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(-1, t\_1, \frac{z}{z - a}\right) - \frac{a}{z - a}, \frac{t \cdot \left(z - y\right)}{z - a}\right)\\ \mathbf{else}:\\ \;\;\;\;x + t\_1 \cdot \left(t - 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-86)
     (fma (* (/ 1.0 (- z a)) (- z y)) (- t x) x)
     (if (<= t_2 1e-7)
       (fma
        x
        (- (fma -1.0 t_1 (/ z (- z a))) (/ a (- z a)))
        (/ (* t (- z y)) (- z a)))
       (+ x (* t_1 (- t 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-86) {
		tmp = fma(((1.0 / (z - a)) * (z - y)), (t - x), x);
	} else if (t_2 <= 1e-7) {
		tmp = fma(x, (fma(-1.0, t_1, (z / (z - a))) - (a / (z - a))), ((t * (z - y)) / (z - a)));
	} else {
		tmp = x + (t_1 * (t - 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(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if (t_2 <= -5e-86)
		tmp = fma(Float64(Float64(1.0 / Float64(z - a)) * Float64(z - y)), Float64(t - x), x);
	elseif (t_2 <= 1e-7)
		tmp = fma(x, Float64(fma(-1.0, t_1, Float64(z / Float64(z - a))) - Float64(a / Float64(z - a))), Float64(Float64(t * Float64(z - y)) / Float64(z - a)));
	else
		tmp = Float64(x + Float64(t_1 * Float64(t - 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[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-86], N[(N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 1e-7], N[(x * N[(N[(-1.0 * t$95$1 + N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;x + t\_1 \cdot \left(t - x\right)\\


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

    1. Initial program 80.1%

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

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

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

    if -4.9999999999999999e-86 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 9.9999999999999995e-8

    1. Initial program 80.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{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 9.9999999999999995e-8 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 80.1%

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

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

Alternative 2: 91.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_1 \leq -4 \cdot 10^{-254}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{z - a} \cdot \left(z - y\right), t - x, 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}:\\ \;\;\;\;x + \frac{z - y}{z - a} \cdot \left(t - 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 -4e-254)
     (fma (* (/ 1.0 (- z a)) (- z y)) (- t x) x)
     (if (<= t_1 0.0)
       (+ t (* -1.0 (/ (- (* y (- t x)) (* a (- t x))) z)))
       (+ x (* (/ (- z y) (- z a)) (- t 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 <= -4e-254) {
		tmp = fma(((1.0 / (z - a)) * (z - y)), (t - x), x);
	} else if (t_1 <= 0.0) {
		tmp = t + (-1.0 * (((y * (t - x)) - (a * (t - x))) / z));
	} else {
		tmp = x + (((z - y) / (z - a)) * (t - x));
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if (t_1 <= -4e-254)
		tmp = fma(Float64(Float64(1.0 / Float64(z - a)) * Float64(z - y)), Float64(t - x), 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 = Float64(x + Float64(Float64(Float64(z - y) / Float64(z - a)) * Float64(t - x)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-254], N[(N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision] * N[(t - x), $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[(x + N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-254}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{z - a} \cdot \left(z - y\right), t - x, 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}:\\
\;\;\;\;x + \frac{z - y}{z - a} \cdot \left(t - x\right)\\


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

    1. Initial program 80.1%

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

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

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

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

    1. Initial program 80.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{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 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 80.1%

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

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

Alternative 3: 87.7% accurate, 0.3× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x + \frac{z - y}{z - a} \cdot \left(t - x\right)\\


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

    1. Initial program 80.1%

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

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

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

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

    1. Initial program 80.1%

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

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

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

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

    1. Initial program 80.1%

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

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

Alternative 4: 87.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z - y}{z - a}\\ t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_2 \leq -4 \cdot 10^{-254}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, t - x, x\right)\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)\\ \mathbf{else}:\\ \;\;\;\;x + t\_1 \cdot \left(t - 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 -4e-254)
     (fma t_1 (- t x) x)
     (if (<= t_2 0.0)
       (* t (- (/ y (- a z)) (/ z (- a z))))
       (+ x (* t_1 (- t 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 <= -4e-254) {
		tmp = fma(t_1, (t - x), x);
	} else if (t_2 <= 0.0) {
		tmp = t * ((y / (a - z)) - (z / (a - z)));
	} else {
		tmp = x + (t_1 * (t - 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(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if (t_2 <= -4e-254)
		tmp = fma(t_1, Float64(t - x), x);
	elseif (t_2 <= 0.0)
		tmp = Float64(t * Float64(Float64(y / Float64(a - z)) - Float64(z / Float64(a - z))));
	else
		tmp = Float64(x + Float64(t_1 * Float64(t - 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[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-254], N[(t$95$1 * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(t * N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;x + t\_1 \cdot \left(t - x\right)\\


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

    1. Initial program 80.1%

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

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

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

    1. Initial program 80.1%

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

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

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

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

    1. Initial program 80.1%

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

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

Alternative 5: 86.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z - y}{z - a}\\ t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-289}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, t - x, x\right)\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;\frac{-1 \cdot \left(a \cdot x\right)}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + t\_1 \cdot \left(t - 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-289)
     (fma t_1 (- t x) x)
     (if (<= t_2 0.0) (/ (* -1.0 (* a x)) (- z a)) (+ x (* t_1 (- t 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-289) {
		tmp = fma(t_1, (t - x), x);
	} else if (t_2 <= 0.0) {
		tmp = (-1.0 * (a * x)) / (z - a);
	} else {
		tmp = x + (t_1 * (t - 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(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if (t_2 <= -5e-289)
		tmp = fma(t_1, Float64(t - x), x);
	elseif (t_2 <= 0.0)
		tmp = Float64(Float64(-1.0 * Float64(a * x)) / Float64(z - a));
	else
		tmp = Float64(x + Float64(t_1 * Float64(t - 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[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-289], N[(t$95$1 * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(-1.0 * N[(a * x), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;x + t\_1 \cdot \left(t - x\right)\\


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

    1. Initial program 80.1%

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

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

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

    1. Initial program 80.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{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} \]

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

    1. Initial program 80.1%

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

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

Alternative 6: 86.4% 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 + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-289}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 0:\\ \;\;\;\;\frac{-1 \cdot \left(a \cdot x\right)}{z - a}\\ \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-289)
     t_1
     (if (<= t_2 0.0) (/ (* -1.0 (* a x)) (- z a)) 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-289) {
		tmp = t_1;
	} else if (t_2 <= 0.0) {
		tmp = (-1.0 * (a * x)) / (z - a);
	} 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(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if (t_2 <= -5e-289)
		tmp = t_1;
	elseif (t_2 <= 0.0)
		tmp = Float64(Float64(-1.0 * Float64(a * x)) / Float64(z - a));
	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[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-289], t$95$1, If[LessEqual[t$95$2, 0.0], N[(N[(-1.0 * N[(a * x), $MachinePrecision]), $MachinePrecision] / N[(z - a), $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 + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-289}:\\
\;\;\;\;t\_1\\

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

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


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

    1. Initial program 80.1%

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

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

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

    1. Initial program 80.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{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} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 82.8% accurate, 0.3× speedup?

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

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

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

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


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

    1. Initial program 80.1%

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

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

    if -1.00000000000000003e-146 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 3.99999999999999986e-274

    1. Initial program 80.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{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 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 72.4% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;y \leq 5.4 \cdot 10^{+46}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.7e114

    1. Initial program 80.1%

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

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

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

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

    if -1.7e114 < y < 5.4000000000000003e46

    1. Initial program 80.1%

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

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

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

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

    if 5.4000000000000003e46 < y

    1. Initial program 80.1%

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

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

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

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

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

Alternative 9: 72.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y}{z - a} \cdot \left(x - t\right)\\ \mathbf{if}\;y \leq -1.7 \cdot 10^{+114}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{+46}:\\ \;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t, x\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.7e+114)
     t_1
     (if (<= y 5.4e+46) (fma (/ (- z y) (- z a)) t x) 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.7e+114) {
		tmp = t_1;
	} else if (y <= 5.4e+46) {
		tmp = fma(((z - y) / (z - a)), t, x);
	} 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.7e+114)
		tmp = t_1;
	elseif (y <= 5.4e+46)
		tmp = fma(Float64(Float64(z - y) / Float64(z - a)), t, x);
	else
		tmp = t_1;
	end
	return 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.7e+114], t$95$1, If[LessEqual[y, 5.4e+46], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * t + x), $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.7 \cdot 10^{+114}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 5.4 \cdot 10^{+46}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.7e114 or 5.4000000000000003e46 < y

    1. Initial program 80.1%

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

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

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

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

    if -1.7e114 < y < 5.4000000000000003e46

    1. Initial program 80.1%

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

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

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

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

Alternative 10: 70.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y}{z - a} \cdot \left(x - t\right)\\ \mathbf{if}\;y \leq -1.7 \cdot 10^{+114}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{+45}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t}{z - a}, z - y, x\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.7e+114)
     t_1
     (if (<= y 1.65e+45) (fma (/ t (- z a)) (- z y) x) 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.7e+114) {
		tmp = t_1;
	} else if (y <= 1.65e+45) {
		tmp = fma((t / (z - a)), (z - y), x);
	} 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.7e+114)
		tmp = t_1;
	elseif (y <= 1.65e+45)
		tmp = fma(Float64(t / Float64(z - a)), Float64(z - y), x);
	else
		tmp = t_1;
	end
	return 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.7e+114], t$95$1, If[LessEqual[y, 1.65e+45], N[(N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $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.7 \cdot 10^{+114}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 1.65 \cdot 10^{+45}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{z - a}, z - y, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.7e114 or 1.65e45 < y

    1. Initial program 80.1%

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

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

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

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

    if -1.7e114 < y < 1.65e45

    1. Initial program 80.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{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(\color{blue}{\frac{t}{z - a}}, z - y, x\right) \]
    4. Applied rewrites63.6%

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

Alternative 11: 59.5% accurate, 0.9× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a}\\


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

    1. Initial program 80.1%

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

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

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

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

    if -1.69999999999999987e154 < a < 4.7e17

    1. Initial program 80.1%

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

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

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

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

    if 4.7e17 < a

    1. Initial program 80.1%

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

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

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

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

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

Alternative 12: 59.4% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.69999999999999987e154 or 1.02e6 < a

    1. Initial program 80.1%

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

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

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

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

    if -1.69999999999999987e154 < a < 1.02e6

    1. Initial program 80.1%

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

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

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

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

Alternative 13: 55.0% accurate, 0.8× speedup?

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

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

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

\mathbf{elif}\;a \leq 1.05 \cdot 10^{-59}:\\
\;\;\;\;\frac{t \cdot z}{z - a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.99999999999999998e-92 or 1.04999999999999998e-59 < a

    1. Initial program 80.1%

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

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

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

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

    if -1.99999999999999998e-92 < a < 8.50000000000000036e-184

    1. Initial program 80.1%

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

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

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

      \[\leadsto \frac{\left(x - t\right) \cdot y}{\color{blue}{z - a}} \]
    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 8.50000000000000036e-184 < a < 1.04999999999999998e-59

    1. Initial program 80.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{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 z around inf

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

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

Alternative 14: 45.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\frac{x \cdot y}{z - a}\\ \mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-105}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-109}:\\ \;\;\;\;\frac{t \cdot z}{z - a}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+307}:\\ \;\;\;\;x + t\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(x - t\right)}{z}\\ \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 (- INFINITY))
     (/ (* x y) (- z a))
     (if (<= t_1 -5e-105)
       (+ x t)
       (if (<= t_1 2e-109)
         (/ (* t z) (- z a))
         (if (<= t_1 2e+307) (+ x t) (/ (* y (- x t)) z)))))))
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 <= -((double) INFINITY)) {
		tmp = (x * y) / (z - a);
	} else if (t_1 <= -5e-105) {
		tmp = x + t;
	} else if (t_1 <= 2e-109) {
		tmp = (t * z) / (z - a);
	} else if (t_1 <= 2e+307) {
		tmp = x + t;
	} else {
		tmp = (y * (x - t)) / z;
	}
	return tmp;
}
public static 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 <= -Double.POSITIVE_INFINITY) {
		tmp = (x * y) / (z - a);
	} else if (t_1 <= -5e-105) {
		tmp = x + t;
	} else if (t_1 <= 2e-109) {
		tmp = (t * z) / (z - a);
	} else if (t_1 <= 2e+307) {
		tmp = x + t;
	} else {
		tmp = (y * (x - t)) / z;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x + ((y - z) * ((t - x) / (a - z)))
	tmp = 0
	if t_1 <= -math.inf:
		tmp = (x * y) / (z - a)
	elif t_1 <= -5e-105:
		tmp = x + t
	elif t_1 <= 2e-109:
		tmp = (t * z) / (z - a)
	elif t_1 <= 2e+307:
		tmp = x + t
	else:
		tmp = (y * (x - t)) / z
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(Float64(x * y) / Float64(z - a));
	elseif (t_1 <= -5e-105)
		tmp = Float64(x + t);
	elseif (t_1 <= 2e-109)
		tmp = Float64(Float64(t * z) / Float64(z - a));
	elseif (t_1 <= 2e+307)
		tmp = Float64(x + t);
	else
		tmp = Float64(Float64(y * Float64(x - t)) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + ((y - z) * ((t - x) / (a - z)));
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = (x * y) / (z - a);
	elseif (t_1 <= -5e-105)
		tmp = x + t;
	elseif (t_1 <= 2e-109)
		tmp = (t * z) / (z - a);
	elseif (t_1 <= 2e+307)
		tmp = x + t;
	else
		tmp = (y * (x - t)) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-105], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, 2e-109], N[(N[(t * z), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+307], N[(x + t), $MachinePrecision], N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-105}:\\
\;\;\;\;x + t\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-109}:\\
\;\;\;\;\frac{t \cdot z}{z - a}\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;x + t\\

\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(x - t\right)}{z}\\


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

    1. Initial program 80.1%

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

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

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

      \[\leadsto \frac{\left(x - t\right) \cdot y}{\color{blue}{z - a}} \]
    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 -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -4.99999999999999963e-105 or 2e-109 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.99999999999999997e307

    1. Initial program 80.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{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 -4.99999999999999963e-105 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 2e-109

    1. Initial program 80.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{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 z around inf

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

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

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

    1. Initial program 80.1%

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

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

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

      \[\leadsto \frac{\left(x - t\right) \cdot y}{\color{blue}{z - a}} \]
    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}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 15: 43.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\frac{x \cdot y}{z - a}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+307}:\\ \;\;\;\;x + t\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(x - t\right)}{z}\\ \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 (- INFINITY))
     (/ (* x y) (- z a))
     (if (<= t_1 2e+307) (+ x t) (/ (* y (- x t)) z)))))
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 <= -((double) INFINITY)) {
		tmp = (x * y) / (z - a);
	} else if (t_1 <= 2e+307) {
		tmp = x + t;
	} else {
		tmp = (y * (x - t)) / z;
	}
	return tmp;
}
public static 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 <= -Double.POSITIVE_INFINITY) {
		tmp = (x * y) / (z - a);
	} else if (t_1 <= 2e+307) {
		tmp = x + t;
	} else {
		tmp = (y * (x - t)) / z;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x + ((y - z) * ((t - x) / (a - z)))
	tmp = 0
	if t_1 <= -math.inf:
		tmp = (x * y) / (z - a)
	elif t_1 <= 2e+307:
		tmp = x + t
	else:
		tmp = (y * (x - t)) / z
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(Float64(x * y) / Float64(z - a));
	elseif (t_1 <= 2e+307)
		tmp = Float64(x + t);
	else
		tmp = Float64(Float64(y * Float64(x - t)) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + ((y - z) * ((t - x) / (a - z)));
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = (x * y) / (z - a);
	elseif (t_1 <= 2e+307)
		tmp = x + t;
	else
		tmp = (y * (x - t)) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+307], N[(x + t), $MachinePrecision], N[(N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;x + t\\

\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(x - t\right)}{z}\\


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

    1. Initial program 80.1%

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

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

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

      \[\leadsto \frac{\left(x - t\right) \cdot y}{\color{blue}{z - a}} \]
    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 -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.99999999999999997e307

    1. Initial program 80.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{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.99999999999999997e307 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 80.1%

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

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

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

      \[\leadsto \frac{\left(x - t\right) \cdot y}{\color{blue}{z - a}} \]
    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}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 16: 42.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y \cdot \left(x - t\right)}{z}\\ t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+307}:\\ \;\;\;\;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)) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
   (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 2e+307) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (y * (x - t)) / z;
	double t_2 = x + ((y - z) * ((t - x) / (a - z)));
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = t_1;
	} else if (t_2 <= 2e+307) {
		tmp = x + t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (y * (x - t)) / z;
	double t_2 = x + ((y - z) * ((t - x) / (a - z)));
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else if (t_2 <= 2e+307) {
		tmp = x + t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (y * (x - t)) / z
	t_2 = x + ((y - z) * ((t - x) / (a - z)))
	tmp = 0
	if t_2 <= -math.inf:
		tmp = t_1
	elif t_2 <= 2e+307:
		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)
	t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = t_1;
	elseif (t_2 <= 2e+307)
		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;
	t_2 = x + ((y - z) * ((t - x) / (a - z)));
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = t_1;
	elseif (t_2 <= 2e+307)
		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]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2e+307], N[(x + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;x + t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0 or 1.99999999999999997e307 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z))))

    1. Initial program 80.1%

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

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

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

      \[\leadsto \frac{\left(x - t\right) \cdot y}{\color{blue}{z - a}} \]
    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 -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 1.99999999999999997e307

    1. Initial program 80.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{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 17: 37.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{t \cdot y}{a - z}\\ t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;x + t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (* t y) (- a z))) (t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
   (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 INFINITY) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (t * y) / (a - z);
	double t_2 = x + ((y - z) * ((t - x) / (a - z)));
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = t_1;
	} else if (t_2 <= ((double) INFINITY)) {
		tmp = x + t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (t * y) / (a - z);
	double t_2 = x + ((y - z) * ((t - x) / (a - z)));
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else if (t_2 <= Double.POSITIVE_INFINITY) {
		tmp = x + t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (t * y) / (a - z)
	t_2 = x + ((y - z) * ((t - x) / (a - z)))
	tmp = 0
	if t_2 <= -math.inf:
		tmp = t_1
	elif t_2 <= math.inf:
		tmp = x + t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(t * y) / Float64(a - z))
	t_2 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z))))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = t_1;
	elseif (t_2 <= Inf)
		tmp = Float64(x + t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (t * y) / (a - z);
	t_2 = x + ((y - z) * ((t - x) / (a - z)));
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = t_1;
	elseif (t_2 <= Inf)
		tmp = x + t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, Infinity], N[(x + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;x + t\\

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


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

    1. Initial program 80.1%

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

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

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

      \[\leadsto \frac{t \cdot y}{\color{blue}{a - z}} \]
    5. Applied rewrites21.2%

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

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

    1. Initial program 80.1%

      \[x + \left(y - z\right) \cdot \frac{t - x}{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: 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 80.1%

    \[x + \left(y - z\right) \cdot \frac{t - x}{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 "Numeric.Signal:interpolate   from hsignal-0.2.7.1"
  :precision binary64
  (+ x (* (- y z) (/ (- t x) (- a z)))))