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

Percentage Accurate: 93.3% → 96.1%
Time: 2.7s
Alternatives: 11
Speedup: 1.0×

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 11 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.3% 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: 96.1% accurate, 0.5× speedup?

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

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


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

    1. Initial program 93.3%

      \[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. lift-*.f64N/A

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{z - t}{a}\right), y, x\right)} \]
      10. distribute-neg-fracN/A

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

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

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

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

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

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

    if 1.9999999999999999e-60 < (-.f64 x (/.f64 (*.f64 y (-.f64 z t)) a))

    1. Initial program 93.3%

      \[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.5%

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

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

Alternative 2: 93.5% accurate, 1.0× speedup?

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

    \[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. lift-*.f64N/A

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{z - t}{a}\right), y, x\right)} \]
    10. distribute-neg-fracN/A

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

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

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

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

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

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

Alternative 3: 84.0% accurate, 0.7× speedup?

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

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

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -9.9999999999999996e86 or 9.4999999999999999e-46 < t

    1. Initial program 93.3%

      \[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. lift-*.f64N/A

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{z - t}{a}\right), y, x\right)} \]
      10. distribute-neg-fracN/A

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

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

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

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

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

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

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

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

      if -9.9999999999999996e86 < t < 9.4999999999999999e-46

      1. Initial program 93.3%

        \[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.7%

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

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

    Alternative 4: 83.8% accurate, 0.3× speedup?

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

      1. Initial program 93.3%

        \[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-/.f6455.0%

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

        \[\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-*.f6455.0%

          \[\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-/.f6456.8%

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

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

      if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) a) < -2.5e10

      1. Initial program 93.3%

        \[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-/.f6455.0%

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

        \[\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. sub-negate-revN/A

          \[\leadsto y \cdot \left(\mathsf{neg}\left(\left(\frac{z}{a} - \frac{t}{a}\right)\right)\right) \]
        4. distribute-rgt-neg-outN/A

          \[\leadsto \mathsf{neg}\left(y \cdot \left(\frac{z}{a} - \frac{t}{a}\right)\right) \]
        5. distribute-lft-neg-inN/A

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

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

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

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

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

          \[\leadsto \frac{\mathsf{neg}\left(y \cdot \left(z - t\right)\right)}{a} \]
        11. lower-/.f64N/A

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

          \[\leadsto \frac{\mathsf{neg}\left(\left(z - t\right) \cdot y\right)}{a} \]
        13. distribute-lft-neg-outN/A

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

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

          \[\leadsto \frac{\left(t - z\right) \cdot y}{a} \]
        16. lower-*.f6456.7%

          \[\leadsto \frac{\left(t - z\right) \cdot y}{a} \]
      6. Applied rewrites56.7%

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

      if -2.5e10 < (/.f64 (*.f64 y (-.f64 z t)) a) < 1e100

      1. Initial program 93.3%

        \[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. lift-*.f64N/A

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{z - t}{a}\right), y, x\right)} \]
        10. distribute-neg-fracN/A

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

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

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

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

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

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

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

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

      Alternative 5: 82.6% accurate, 0.4× speedup?

      \[\begin{array}{l} t_1 := \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{if}\;t\_1 \leq -25000000000:\\ \;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\ \mathbf{elif}\;t\_1 \leq 10^{+100}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t - z}{a} \cdot y\\ \end{array} \]
      (FPCore (x y z t a)
        :precision binary64
        (let* ((t_1 (/ (* y (- z t)) a)))
        (if (<= t_1 -25000000000.0)
          (* (/ y a) (- t z))
          (if (<= t_1 1e+100) (fma (/ t a) y x) (* (/ (- t z) a) y)))))
      double code(double x, double y, double z, double t, double a) {
      	double t_1 = (y * (z - t)) / a;
      	double tmp;
      	if (t_1 <= -25000000000.0) {
      		tmp = (y / a) * (t - z);
      	} else if (t_1 <= 1e+100) {
      		tmp = fma((t / a), y, x);
      	} else {
      		tmp = ((t - z) / a) * y;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t, a)
      	t_1 = Float64(Float64(y * Float64(z - t)) / a)
      	tmp = 0.0
      	if (t_1 <= -25000000000.0)
      		tmp = Float64(Float64(y / a) * Float64(t - z));
      	elseif (t_1 <= 1e+100)
      		tmp = fma(Float64(t / a), y, x);
      	else
      		tmp = Float64(Float64(Float64(t - z) / a) * y);
      	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, -25000000000.0], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+100], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]]]]
      
      \begin{array}{l}
      t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
      \mathbf{if}\;t\_1 \leq -25000000000:\\
      \;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
      
      \mathbf{elif}\;t\_1 \leq 10^{+100}:\\
      \;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{t - z}{a} \cdot y\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (/.f64 (*.f64 y (-.f64 z t)) a) < -2.5e10

        1. Initial program 93.3%

          \[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-/.f6455.0%

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

          \[\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.1%

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

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

        if -2.5e10 < (/.f64 (*.f64 y (-.f64 z t)) a) < 1e100

        1. Initial program 93.3%

          \[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. lift-*.f64N/A

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{z - t}{a}\right), y, x\right)} \]
          10. distribute-neg-fracN/A

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

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

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

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

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

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

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

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

          if 1e100 < (/.f64 (*.f64 y (-.f64 z t)) a)

          1. Initial program 93.3%

            \[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-/.f6455.0%

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

            \[\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-*.f6455.0%

              \[\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-/.f6456.8%

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

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

        Alternative 6: 82.3% accurate, 0.4× speedup?

        \[\begin{array}{l} t_1 := \frac{y \cdot \left(z - t\right)}{a}\\ t_2 := \frac{t - z}{a} \cdot y\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+135}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 10^{+100}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, 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 (* (/ (- t z) a) y)))
          (if (<= t_1 -2e+135)
            t_2
            (if (<= t_1 1e+100) (fma (/ t a) y 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 - z) / a) * y;
        	double tmp;
        	if (t_1 <= -2e+135) {
        		tmp = t_2;
        	} else if (t_1 <= 1e+100) {
        		tmp = fma((t / a), y, 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(Float64(t - z) / a) * y)
        	tmp = 0.0
        	if (t_1 <= -2e+135)
        		tmp = t_2;
        	elseif (t_1 <= 1e+100)
        		tmp = fma(Float64(t / a), y, 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[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+135], t$95$2, If[LessEqual[t$95$1, 1e+100], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], t$95$2]]]]
        
        \begin{array}{l}
        t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
        t_2 := \frac{t - z}{a} \cdot y\\
        \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+135}:\\
        \;\;\;\;t\_2\\
        
        \mathbf{elif}\;t\_1 \leq 10^{+100}:\\
        \;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_2\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (/.f64 (*.f64 y (-.f64 z t)) a) < -1.9999999999999999e135 or 1e100 < (/.f64 (*.f64 y (-.f64 z t)) a)

          1. Initial program 93.3%

            \[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-/.f6455.0%

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

            \[\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-*.f6455.0%

              \[\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-/.f6456.8%

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

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

          if -1.9999999999999999e135 < (/.f64 (*.f64 y (-.f64 z t)) a) < 1e100

          1. Initial program 93.3%

            \[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. lift-*.f64N/A

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

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

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{z - t}{a}\right), y, x\right)} \]
            10. distribute-neg-fracN/A

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

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

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

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

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

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

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

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

          Alternative 7: 71.2% accurate, 0.7× speedup?

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

            1. Initial program 93.3%

              \[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.5%

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

              \[\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 rewrites71.2%

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

              if -4.9999999999999997e-89 < (*.f64 y (-.f64 z t))

              1. Initial program 93.3%

                \[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. lift-*.f64N/A

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

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

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

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

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\frac{z - t}{a}\right), y, x\right)} \]
                10. distribute-neg-fracN/A

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

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

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

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

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

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

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

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

              Alternative 8: 69.6% 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.3%

                \[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.5%

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

                \[\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 rewrites71.2%

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

                Alternative 9: 32.8% accurate, 0.7× speedup?

                \[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \leq -5 \cdot 10^{-89}:\\ \;\;\;\;\frac{t}{\frac{a}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{a} \cdot y\\ \end{array} \]
                (FPCore (x y z t a)
                  :precision binary64
                  (if (<= (* y (- z t)) -5e-89) (/ t (/ a y)) (* (/ t a) y)))
                double code(double x, double y, double z, double t, double a) {
                	double tmp;
                	if ((y * (z - t)) <= -5e-89) {
                		tmp = t / (a / y);
                	} else {
                		tmp = (t / a) * y;
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x, y, z, t, a)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    real(8), intent (in) :: t
                    real(8), intent (in) :: a
                    real(8) :: tmp
                    if ((y * (z - t)) <= (-5d-89)) then
                        tmp = t / (a / y)
                    else
                        tmp = (t / a) * y
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z, double t, double a) {
                	double tmp;
                	if ((y * (z - t)) <= -5e-89) {
                		tmp = t / (a / y);
                	} else {
                		tmp = (t / a) * y;
                	}
                	return tmp;
                }
                
                def code(x, y, z, t, a):
                	tmp = 0
                	if (y * (z - t)) <= -5e-89:
                		tmp = t / (a / y)
                	else:
                		tmp = (t / a) * y
                	return tmp
                
                function code(x, y, z, t, a)
                	tmp = 0.0
                	if (Float64(y * Float64(z - t)) <= -5e-89)
                		tmp = Float64(t / Float64(a / y));
                	else
                		tmp = Float64(Float64(t / a) * y);
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z, t, a)
                	tmp = 0.0;
                	if ((y * (z - t)) <= -5e-89)
                		tmp = t / (a / y);
                	else
                		tmp = (t / a) * y;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_, t_, a_] := If[LessEqual[N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision], -5e-89], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]]
                
                \begin{array}{l}
                \mathbf{if}\;y \cdot \left(z - t\right) \leq -5 \cdot 10^{-89}:\\
                \;\;\;\;\frac{t}{\frac{a}{y}}\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{t}{a} \cdot y\\
                
                
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (*.f64 y (-.f64 z t)) < -4.9999999999999997e-89

                  1. Initial program 93.3%

                    \[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.3%

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

                    \[\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-*.f6431.3%

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

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

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

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

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

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

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

                      \[\leadsto t \cdot \frac{y}{\color{blue}{a}} \]
                    7. div-flip-revN/A

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

                      \[\leadsto t \cdot \frac{1}{\frac{a}{\color{blue}{y}}} \]
                    9. mult-flip-revN/A

                      \[\leadsto \frac{t}{\color{blue}{\frac{a}{y}}} \]
                    10. lower-/.f6434.0%

                      \[\leadsto \frac{t}{\color{blue}{\frac{a}{y}}} \]
                  8. Applied rewrites34.0%

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

                  if -4.9999999999999997e-89 < (*.f64 y (-.f64 z t))

                  1. Initial program 93.3%

                    \[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.3%

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

                    \[\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-*.f6431.3%

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

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

                Alternative 10: 32.7% accurate, 0.8× speedup?

                \[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \leq -5 \cdot 10^{-89}:\\ \;\;\;\;\frac{y}{a} \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{a} \cdot y\\ \end{array} \]
                (FPCore (x y z t a)
                  :precision binary64
                  (if (<= (* y (- z t)) -5e-89) (* (/ y a) t) (* (/ t a) y)))
                double code(double x, double y, double z, double t, double a) {
                	double tmp;
                	if ((y * (z - t)) <= -5e-89) {
                		tmp = (y / a) * t;
                	} else {
                		tmp = (t / a) * y;
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x, y, z, t, a)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    real(8), intent (in) :: t
                    real(8), intent (in) :: a
                    real(8) :: tmp
                    if ((y * (z - t)) <= (-5d-89)) then
                        tmp = (y / a) * t
                    else
                        tmp = (t / a) * y
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z, double t, double a) {
                	double tmp;
                	if ((y * (z - t)) <= -5e-89) {
                		tmp = (y / a) * t;
                	} else {
                		tmp = (t / a) * y;
                	}
                	return tmp;
                }
                
                def code(x, y, z, t, a):
                	tmp = 0
                	if (y * (z - t)) <= -5e-89:
                		tmp = (y / a) * t
                	else:
                		tmp = (t / a) * y
                	return tmp
                
                function code(x, y, z, t, a)
                	tmp = 0.0
                	if (Float64(y * Float64(z - t)) <= -5e-89)
                		tmp = Float64(Float64(y / a) * t);
                	else
                		tmp = Float64(Float64(t / a) * y);
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z, t, a)
                	tmp = 0.0;
                	if ((y * (z - t)) <= -5e-89)
                		tmp = (y / a) * t;
                	else
                		tmp = (t / a) * y;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_, t_, a_] := If[LessEqual[N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision], -5e-89], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]]
                
                \begin{array}{l}
                \mathbf{if}\;y \cdot \left(z - t\right) \leq -5 \cdot 10^{-89}:\\
                \;\;\;\;\frac{y}{a} \cdot t\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{t}{a} \cdot y\\
                
                
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (*.f64 y (-.f64 z t)) < -4.9999999999999997e-89

                  1. Initial program 93.3%

                    \[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.3%

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

                    \[\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.3%

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

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

                  if -4.9999999999999997e-89 < (*.f64 y (-.f64 z t))

                  1. Initial program 93.3%

                    \[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.3%

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

                    \[\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-*.f6431.3%

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

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

                Alternative 11: 31.3% accurate, 1.7× speedup?

                \[\frac{t}{a} \cdot y \]
                (FPCore (x y z t a)
                  :precision binary64
                  (* (/ t a) y))
                double code(double x, double y, double z, double t, double a) {
                	return (t / a) * y;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x, y, z, t, 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 = (t / a) * y
                end function
                
                public static double code(double x, double y, double z, double t, double a) {
                	return (t / a) * y;
                }
                
                def code(x, y, z, t, a):
                	return (t / a) * y
                
                function code(x, y, z, t, a)
                	return Float64(Float64(t / a) * y)
                end
                
                function tmp = code(x, y, z, t, a)
                	tmp = (t / a) * y;
                end
                
                code[x_, y_, z_, t_, a_] := N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision]
                
                \frac{t}{a} \cdot y
                
                Derivation
                1. Initial program 93.3%

                  \[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.3%

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

                  \[\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-*.f6431.3%

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

                  \[\leadsto \frac{t}{a} \cdot \color{blue}{y} \]
                7. Add Preprocessing

                Reproduce

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