Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F

Percentage Accurate: 93.0% → 97.3%
Time: 2.3s
Alternatives: 8
Speedup: 1.1×

Specification

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 93.0% accurate, 1.0× speedup?

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

Alternative 1: 97.3% accurate, 1.1× speedup?

\[\mathsf{fma}\left(\frac{y}{a}, t - z, x\right) \]
(FPCore (x y z t a) :precision binary64 (fma (/ y a) (- t z) x))
double code(double x, double y, double z, double t, double a) {
	return fma((y / a), (t - z), x);
}
function code(x, y, z, t, a)
	return fma(Float64(y / a), Float64(t - z), x)
end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision] + x), $MachinePrecision]
\mathsf{fma}\left(\frac{y}{a}, t - z, x\right)
Derivation
  1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot \frac{1}{a}, t - z, x\right)} \]
    14. mult-flip-revN/A

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

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

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

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

Alternative 2: 84.9% accurate, 0.7× speedup?

\[\begin{array}{l} t_1 := \mathsf{fma}\left(\frac{y}{a}, t, x\right)\\ \mathbf{if}\;t \leq -4.05 \cdot 10^{+46}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{-9}:\\ \;\;\;\;x - \frac{y \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (fma (/ y a) t x)))
   (if (<= t -4.05e+46) t_1 (if (<= t 3.5e-9) (- x (/ (* y z) a)) t_1))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = fma((y / a), t, x);
	double tmp;
	if (t <= -4.05e+46) {
		tmp = t_1;
	} else if (t <= 3.5e-9) {
		tmp = x - ((y * z) / a);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a)
	t_1 = fma(Float64(y / a), t, x)
	tmp = 0.0
	if (t <= -4.05e+46)
		tmp = t_1;
	elseif (t <= 3.5e-9)
		tmp = Float64(x - Float64(Float64(y * 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] * t + x), $MachinePrecision]}, If[LessEqual[t, -4.05e+46], t$95$1, If[LessEqual[t, 3.5e-9], N[(x - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{if}\;t \leq -4.05 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 3.5 \cdot 10^{-9}:\\
\;\;\;\;x - \frac{y \cdot z}{a}\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.05000000000000024e46 or 3.4999999999999999e-9 < t

    1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot \frac{1}{a}, t - z, x\right)} \]
      14. mult-flip-revN/A

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{y}{a}, \color{blue}{t}, x\right) \]
    5. Step-by-step derivation
      1. Applied rewrites70.9%

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

      if -4.05000000000000024e46 < t < 3.4999999999999999e-9

      1. Initial program 93.0%

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

        \[\leadsto x - \frac{\color{blue}{y \cdot z}}{a} \]
      3. Step-by-step derivation
        1. lower-*.f6468.2%

          \[\leadsto x - \frac{y \cdot \color{blue}{z}}{a} \]
      4. Applied rewrites68.2%

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

    Alternative 3: 83.9% accurate, 0.4× speedup?

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

      1. Initial program 93.0%

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

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

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

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

          \[\leadsto y \cdot \left(\frac{t}{a} - \frac{\color{blue}{z}}{a}\right) \]
        4. lower-/.f6456.2%

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

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

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

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

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

          \[\leadsto \left(\frac{t}{a} - \frac{z}{a}\right) \cdot y \]
        5. lift-/.f64N/A

          \[\leadsto \left(\frac{t}{a} - \frac{z}{a}\right) \cdot y \]
        6. lift-/.f64N/A

          \[\leadsto \left(\frac{t}{a} - \frac{z}{a}\right) \cdot y \]
        7. sub-divN/A

          \[\leadsto \frac{t - z}{a} \cdot y \]
        8. lift--.f64N/A

          \[\leadsto \frac{t - z}{a} \cdot y \]
        9. lift-/.f6457.7%

          \[\leadsto \frac{t - z}{a} \cdot y \]
      6. Applied rewrites57.7%

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

      if -5.00000000000000007e239 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2e8

      1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot \frac{1}{a}, t - z, x\right)} \]
        14. mult-flip-revN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{a}, \color{blue}{t}, x\right) \]
      5. Step-by-step derivation
        1. Applied rewrites70.9%

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

        if 2e8 < (/.f64 (*.f64 y (-.f64 z t)) a)

        1. Initial program 93.0%

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

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

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

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

            \[\leadsto y \cdot \left(\frac{t}{a} - \frac{\color{blue}{z}}{a}\right) \]
          4. lower-/.f6456.2%

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

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

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

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

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

            \[\leadsto y \cdot \left(\frac{t}{a} - \frac{z}{\color{blue}{a}}\right) \]
          5. sub-divN/A

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

            \[\leadsto y \cdot \frac{t - z}{a} \]
          7. associate-/l*N/A

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

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

            \[\leadsto \frac{y}{a} \cdot \left(\color{blue}{t} - z\right) \]
          10. lower-*.f6460.2%

            \[\leadsto \frac{y}{a} \cdot \color{blue}{\left(t - z\right)} \]
        6. Applied rewrites60.2%

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

      Alternative 4: 83.5% accurate, 0.4× speedup?

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

        1. Initial program 93.0%

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

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

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

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

            \[\leadsto y \cdot \left(\frac{t}{a} - \frac{\color{blue}{z}}{a}\right) \]
          4. lower-/.f6456.2%

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

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

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

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

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

            \[\leadsto y \cdot \left(\frac{t}{a} - \frac{z}{\color{blue}{a}}\right) \]
          5. sub-divN/A

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

            \[\leadsto y \cdot \frac{t - z}{a} \]
          7. associate-/l*N/A

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

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

            \[\leadsto \frac{y}{a} \cdot \left(\color{blue}{t} - z\right) \]
          10. lower-*.f6460.2%

            \[\leadsto \frac{y}{a} \cdot \color{blue}{\left(t - z\right)} \]
        6. Applied rewrites60.2%

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

        if -5.00000000000000007e239 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2e8

        1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot \frac{1}{a}, t - z, x\right)} \]
          14. mult-flip-revN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{y}{a}, \color{blue}{t}, x\right) \]
        5. Step-by-step derivation
          1. Applied rewrites70.9%

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

        Alternative 5: 70.9% accurate, 1.3× speedup?

        \[\mathsf{fma}\left(\frac{y}{a}, t, x\right) \]
        (FPCore (x y z t a) :precision binary64 (fma (/ y a) t x))
        double code(double x, double y, double z, double t, double a) {
        	return fma((y / a), t, x);
        }
        
        function code(x, y, z, t, a)
        	return fma(Float64(y / a), t, x)
        end
        
        code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision]
        
        \mathsf{fma}\left(\frac{y}{a}, t, x\right)
        
        Derivation
        1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot \frac{1}{a}, t - z, x\right)} \]
          14. mult-flip-revN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{y}{a}, \color{blue}{t}, x\right) \]
        5. Step-by-step derivation
          1. Applied rewrites70.9%

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

          Alternative 6: 59.6% accurate, 0.4× speedup?

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

            1. Initial program 93.0%

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

              \[\leadsto \color{blue}{\frac{t \cdot y}{a}} \]
            3. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{t \cdot y}{\color{blue}{a}} \]
              2. lower-*.f6431.5%

                \[\leadsto \frac{t \cdot y}{a} \]
            4. Applied rewrites31.5%

              \[\leadsto \color{blue}{\frac{t \cdot y}{a}} \]
            5. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \frac{t \cdot y}{\color{blue}{a}} \]
              2. lift-*.f64N/A

                \[\leadsto \frac{t \cdot y}{a} \]
              3. associate-/l*N/A

                \[\leadsto t \cdot \color{blue}{\frac{y}{a}} \]
              4. lift-/.f64N/A

                \[\leadsto t \cdot \frac{y}{\color{blue}{a}} \]
              5. *-commutativeN/A

                \[\leadsto \frac{y}{a} \cdot \color{blue}{t} \]
              6. lower-*.f6434.4%

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

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

            if -1.99999999999999989e119 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2.0000000000000002e44

            1. Initial program 93.0%

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

              \[\leadsto \color{blue}{\frac{t \cdot y}{a}} \]
            3. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{t \cdot y}{\color{blue}{a}} \]
              2. lower-*.f6431.5%

                \[\leadsto \frac{t \cdot y}{a} \]
            4. Applied rewrites31.5%

              \[\leadsto \color{blue}{\frac{t \cdot y}{a}} \]
            5. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \frac{t \cdot y}{\color{blue}{a}} \]
              2. lift-*.f64N/A

                \[\leadsto \frac{t \cdot y}{a} \]
              3. associate-/l*N/A

                \[\leadsto t \cdot \color{blue}{\frac{y}{a}} \]
              4. lift-/.f64N/A

                \[\leadsto t \cdot \frac{y}{\color{blue}{a}} \]
              5. *-commutativeN/A

                \[\leadsto \frac{y}{a} \cdot \color{blue}{t} \]
              6. lower-*.f6434.4%

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

              \[\leadsto \frac{y}{a} \cdot \color{blue}{t} \]
            7. Taylor expanded in x around inf

              \[\leadsto \color{blue}{x} \]
            8. Step-by-step derivation
              1. Applied rewrites39.0%

                \[\leadsto \color{blue}{x} \]
            9. Recombined 2 regimes into one program.
            10. Add Preprocessing

            Alternative 7: 56.7% accurate, 0.4× speedup?

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

              1. Initial program 93.0%

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

                \[\leadsto \color{blue}{\frac{t \cdot y}{a}} \]
              3. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \frac{t \cdot y}{\color{blue}{a}} \]
                2. lower-*.f6431.5%

                  \[\leadsto \frac{t \cdot y}{a} \]
              4. Applied rewrites31.5%

                \[\leadsto \color{blue}{\frac{t \cdot y}{a}} \]
              5. Step-by-step derivation
                1. lift-/.f64N/A

                  \[\leadsto \frac{t \cdot y}{\color{blue}{a}} \]
                2. lift-*.f64N/A

                  \[\leadsto \frac{t \cdot y}{a} \]
                3. associate-*l/N/A

                  \[\leadsto \frac{t}{a} \cdot \color{blue}{y} \]
                4. lift-/.f64N/A

                  \[\leadsto \frac{t}{a} \cdot y \]
                5. lower-*.f6432.0%

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

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

              if -5.00000000000000007e239 < (/.f64 (*.f64 y (-.f64 z t)) a) < 1e167

              1. Initial program 93.0%

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

                \[\leadsto \color{blue}{\frac{t \cdot y}{a}} \]
              3. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \frac{t \cdot y}{\color{blue}{a}} \]
                2. lower-*.f6431.5%

                  \[\leadsto \frac{t \cdot y}{a} \]
              4. Applied rewrites31.5%

                \[\leadsto \color{blue}{\frac{t \cdot y}{a}} \]
              5. Step-by-step derivation
                1. lift-/.f64N/A

                  \[\leadsto \frac{t \cdot y}{\color{blue}{a}} \]
                2. lift-*.f64N/A

                  \[\leadsto \frac{t \cdot y}{a} \]
                3. associate-/l*N/A

                  \[\leadsto t \cdot \color{blue}{\frac{y}{a}} \]
                4. lift-/.f64N/A

                  \[\leadsto t \cdot \frac{y}{\color{blue}{a}} \]
                5. *-commutativeN/A

                  \[\leadsto \frac{y}{a} \cdot \color{blue}{t} \]
                6. lower-*.f6434.4%

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

                \[\leadsto \frac{y}{a} \cdot \color{blue}{t} \]
              7. Taylor expanded in x around inf

                \[\leadsto \color{blue}{x} \]
              8. Step-by-step derivation
                1. Applied rewrites39.0%

                  \[\leadsto \color{blue}{x} \]
              9. Recombined 2 regimes into one program.
              10. Add Preprocessing

              Alternative 8: 39.0% accurate, 12.6× speedup?

              \[x \]
              (FPCore (x y z t a) :precision binary64 x)
              double code(double x, double y, double z, double t, double a) {
              	return x;
              }
              
              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
              end function
              
              public static double code(double x, double y, double z, double t, double a) {
              	return x;
              }
              
              def code(x, y, z, t, a):
              	return x
              
              function code(x, y, z, t, a)
              	return x
              end
              
              function tmp = code(x, y, z, t, a)
              	tmp = x;
              end
              
              code[x_, y_, z_, t_, a_] := x
              
              x
              
              Derivation
              1. Initial program 93.0%

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

                \[\leadsto \color{blue}{\frac{t \cdot y}{a}} \]
              3. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \frac{t \cdot y}{\color{blue}{a}} \]
                2. lower-*.f6431.5%

                  \[\leadsto \frac{t \cdot y}{a} \]
              4. Applied rewrites31.5%

                \[\leadsto \color{blue}{\frac{t \cdot y}{a}} \]
              5. Step-by-step derivation
                1. lift-/.f64N/A

                  \[\leadsto \frac{t \cdot y}{\color{blue}{a}} \]
                2. lift-*.f64N/A

                  \[\leadsto \frac{t \cdot y}{a} \]
                3. associate-/l*N/A

                  \[\leadsto t \cdot \color{blue}{\frac{y}{a}} \]
                4. lift-/.f64N/A

                  \[\leadsto t \cdot \frac{y}{\color{blue}{a}} \]
                5. *-commutativeN/A

                  \[\leadsto \frac{y}{a} \cdot \color{blue}{t} \]
                6. lower-*.f6434.4%

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

                \[\leadsto \frac{y}{a} \cdot \color{blue}{t} \]
              7. Taylor expanded in x around inf

                \[\leadsto \color{blue}{x} \]
              8. Step-by-step derivation
                1. Applied rewrites39.0%

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

                Reproduce

                ?
                herbie shell --seed 2025188 
                (FPCore (x y z t a)
                  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
                  :precision binary64
                  (- x (/ (* y (- z t)) a)))