Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B

Percentage Accurate: 76.5% → 98.5%
Time: 4.8s
Alternatives: 9
Speedup: 1.2×

Specification

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

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

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = (x + y) - (((z - t) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
	return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a):
	return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a)
	return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t)))
end
function tmp = code(x, y, z, t, a)
	tmp = (x + y) - (((z - t) * y) / (a - t));
end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 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: 76.5% accurate, 1.0× speedup?

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

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

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = (x + y) - (((z - t) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
	return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a):
	return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a)
	return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t)))
end
function tmp = code(x, y, z, t, a)
	tmp = (x + y) - (((z - t) * y) / (a - t));
end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 98.5% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right) \]
      4. add-to-fractionN/A

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 \cdot \left(a - t\right) + t\right) \cdot \frac{1}{a - t} - z \cdot \color{blue}{\frac{1}{a - t}}\right) \]
      8. distribute-rgt-out--N/A

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

        \[\leadsto x + y \cdot \left(\frac{1}{a - t} \cdot \left(\left(\left(a - t\right) + t\right) - z\right)\right) \]
      10. sum-to-mult-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{-1}{t - a} \cdot \left(\left(t - \left(t - a\right)\right) - z\right)\right) \cdot y + x \]
      5. lower-fma.f6493.3

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

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

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

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right) \]
      4. add-to-fractionN/A

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 \cdot \left(a - t\right) + t\right) \cdot \frac{1}{a - t} - z \cdot \color{blue}{\frac{1}{a - t}}\right) \]
      8. distribute-rgt-out--N/A

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

        \[\leadsto x + y \cdot \left(\frac{1}{a - t} \cdot \left(\left(\left(a - t\right) + t\right) - z\right)\right) \]
      10. sum-to-mult-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{neg}\left(\left(y \cdot \frac{-1}{t - a}\right) \cdot \left(\mathsf{neg}\left(\left(\left(t - \left(t - a\right)\right) - z\right)\right)\right)\right)\right) + x \]
      11. mul-1-negN/A

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

        \[\leadsto \left(\mathsf{neg}\left(y \cdot \frac{-1}{t - a}\right)\right) \cdot \left(-1 \cdot \left(\left(t - \left(t - a\right)\right) - z\right)\right) + x \]
    8. Applied rewrites95.9%

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

Alternative 2: 95.9% accurate, 1.2× speedup?

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

\\
\mathsf{fma}\left(\frac{y}{t - a}, z - a, x\right)
\end{array}
Derivation
  1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right) \]
    4. add-to-fractionN/A

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

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

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

      \[\leadsto x + y \cdot \left(\left(1 \cdot \left(a - t\right) + t\right) \cdot \frac{1}{a - t} - z \cdot \color{blue}{\frac{1}{a - t}}\right) \]
    8. distribute-rgt-out--N/A

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

      \[\leadsto x + y \cdot \left(\frac{1}{a - t} \cdot \left(\left(\left(a - t\right) + t\right) - z\right)\right) \]
    10. sum-to-mult-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(\left(y \cdot \frac{-1}{t - a}\right) \cdot \left(\mathsf{neg}\left(\left(\left(t - \left(t - a\right)\right) - z\right)\right)\right)\right)\right) + x \]
    11. mul-1-negN/A

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

      \[\leadsto \left(\mathsf{neg}\left(y \cdot \frac{-1}{t - a}\right)\right) \cdot \left(-1 \cdot \left(\left(t - \left(t - a\right)\right) - z\right)\right) + x \]
  8. Applied rewrites95.9%

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

Alternative 3: 86.5% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-227}:\\
\;\;\;\;x + y\\

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

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


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

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right) \]
      4. add-to-fractionN/A

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 \cdot \left(a - t\right) + t\right) \cdot \frac{1}{a - t} - z \cdot \color{blue}{\frac{1}{a - t}}\right) \]
      8. distribute-rgt-out--N/A

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

        \[\leadsto x + y \cdot \left(\frac{1}{a - t} \cdot \left(\left(\left(a - t\right) + t\right) - z\right)\right) \]
      10. sum-to-mult-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \frac{z}{t - \color{blue}{a}} \]
      2. lower--.f6476.2

        \[\leadsto x + y \cdot \frac{z}{t - a} \]
    9. Applied rewrites76.2%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z}{t - a}} \]
      2. +-commutativeN/A

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

        \[\leadsto y \cdot \frac{z}{t - a} + x \]
      4. *-commutativeN/A

        \[\leadsto \frac{z}{t - a} \cdot y + x \]
      5. lower-fma.f6476.2

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

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

    if -2.00000000000000003e306 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -4.99999999999999961e-227

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right) \]
      4. add-to-fractionN/A

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 \cdot \left(a - t\right) + t\right) \cdot \frac{1}{a - t} - z \cdot \color{blue}{\frac{1}{a - t}}\right) \]
      8. distribute-rgt-out--N/A

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

        \[\leadsto x + y \cdot \left(\frac{1}{a - t} \cdot \left(\left(\left(a - t\right) + t\right) - z\right)\right) \]
      10. sum-to-mult-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{-1}{t - a} \cdot \left(\left(t - \left(t - a\right)\right) - z\right)\right) \cdot y + x \]
      5. lower-fma.f6493.3

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

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

      \[\leadsto \color{blue}{x + y} \]
    10. Step-by-step derivation
      1. lower-+.f6460.2

        \[\leadsto x + \color{blue}{y} \]
    11. Applied rewrites60.2%

      \[\leadsto \color{blue}{x + y} \]

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

    1. Initial program 76.5%

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

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

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

        \[\leadsto x + -1 \cdot \color{blue}{\frac{a \cdot y - y \cdot z}{t}} \]
      3. lower-/.f64N/A

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{\color{blue}{t}} \]
      4. lower--.f64N/A

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{t} \]
      5. lower-*.f64N/A

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{t} \]
      6. lower-*.f6457.7

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{t} \]
    4. Applied rewrites57.7%

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

        \[\leadsto x + \color{blue}{-1 \cdot \frac{a \cdot y - y \cdot z}{t}} \]
      2. +-commutativeN/A

        \[\leadsto -1 \cdot \frac{a \cdot y - y \cdot z}{t} + \color{blue}{x} \]
      3. lift-*.f64N/A

        \[\leadsto -1 \cdot \frac{a \cdot y - y \cdot z}{t} + x \]
      4. mul-1-negN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(z \cdot \frac{y}{t} - a \cdot \frac{y}{t}\right) + x \]
      14. distribute-rgt-out--N/A

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - a, x\right)} \]
    7. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

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

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

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

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

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

Alternative 4: 82.8% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -3.8000000000000002e66 or 9.50000000000000036e-8 < a

    1. Initial program 76.5%

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

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

        \[\leadsto \left(x + y\right) - \frac{y \cdot z}{\color{blue}{a}} \]
      2. lower-*.f6464.8

        \[\leadsto \left(x + y\right) - \frac{y \cdot z}{a} \]
    4. Applied rewrites64.8%

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

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

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

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

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

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

        \[\leadsto \left(x + y\right) - z \cdot \color{blue}{\left(y \cdot \frac{1}{a}\right)} \]
      7. mult-flip-revN/A

        \[\leadsto \left(x + y\right) - z \cdot \frac{y}{\color{blue}{a}} \]
      8. lower-/.f6466.4

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

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

    if -3.8000000000000002e66 < a < 9.50000000000000036e-8

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right) \]
      4. add-to-fractionN/A

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 \cdot \left(a - t\right) + t\right) \cdot \frac{1}{a - t} - z \cdot \color{blue}{\frac{1}{a - t}}\right) \]
      8. distribute-rgt-out--N/A

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

        \[\leadsto x + y \cdot \left(\frac{1}{a - t} \cdot \left(\left(\left(a - t\right) + t\right) - z\right)\right) \]
      10. sum-to-mult-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \frac{z}{t - \color{blue}{a}} \]
      2. lower--.f6476.2

        \[\leadsto x + y \cdot \frac{z}{t - a} \]
    9. Applied rewrites76.2%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z}{t - a}} \]
      2. +-commutativeN/A

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

        \[\leadsto y \cdot \frac{z}{t - a} + x \]
      4. *-commutativeN/A

        \[\leadsto \frac{z}{t - a} \cdot y + x \]
      5. lower-fma.f6476.2

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

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

Alternative 5: 78.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{+70}:\\
\;\;\;\;x + y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.6e70 or 1.6500000000000001e-7 < a

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right) \]
      4. add-to-fractionN/A

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 \cdot \left(a - t\right) + t\right) \cdot \frac{1}{a - t} - z \cdot \color{blue}{\frac{1}{a - t}}\right) \]
      8. distribute-rgt-out--N/A

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

        \[\leadsto x + y \cdot \left(\frac{1}{a - t} \cdot \left(\left(\left(a - t\right) + t\right) - z\right)\right) \]
      10. sum-to-mult-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{-1}{t - a} \cdot \left(\left(t - \left(t - a\right)\right) - z\right)\right) \cdot y + x \]
      5. lower-fma.f6493.3

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

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

      \[\leadsto \color{blue}{x + y} \]
    10. Step-by-step derivation
      1. lower-+.f6460.2

        \[\leadsto x + \color{blue}{y} \]
    11. Applied rewrites60.2%

      \[\leadsto \color{blue}{x + y} \]

    if -2.6e70 < a < 1.6500000000000001e-7

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right) \]
      4. add-to-fractionN/A

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 \cdot \left(a - t\right) + t\right) \cdot \frac{1}{a - t} - z \cdot \color{blue}{\frac{1}{a - t}}\right) \]
      8. distribute-rgt-out--N/A

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

        \[\leadsto x + y \cdot \left(\frac{1}{a - t} \cdot \left(\left(\left(a - t\right) + t\right) - z\right)\right) \]
      10. sum-to-mult-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \frac{z}{t - \color{blue}{a}} \]
      2. lower--.f6476.2

        \[\leadsto x + y \cdot \frac{z}{t - a} \]
    9. Applied rewrites76.2%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z}{t - a}} \]
      2. +-commutativeN/A

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

        \[\leadsto y \cdot \frac{z}{t - a} + x \]
      4. *-commutativeN/A

        \[\leadsto \frac{z}{t - a} \cdot y + x \]
      5. lower-fma.f6476.2

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

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

Alternative 6: 76.8% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2100:\\
\;\;\;\;x + y\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2100 or 2.39999999999999998e-8 < a

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right) \]
      4. add-to-fractionN/A

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 \cdot \left(a - t\right) + t\right) \cdot \frac{1}{a - t} - z \cdot \color{blue}{\frac{1}{a - t}}\right) \]
      8. distribute-rgt-out--N/A

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

        \[\leadsto x + y \cdot \left(\frac{1}{a - t} \cdot \left(\left(\left(a - t\right) + t\right) - z\right)\right) \]
      10. sum-to-mult-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{-1}{t - a} \cdot \left(\left(t - \left(t - a\right)\right) - z\right)\right) \cdot y + x \]
      5. lower-fma.f6493.3

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

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

      \[\leadsto \color{blue}{x + y} \]
    10. Step-by-step derivation
      1. lower-+.f6460.2

        \[\leadsto x + \color{blue}{y} \]
    11. Applied rewrites60.2%

      \[\leadsto \color{blue}{x + y} \]

    if -2100 < a < 2.39999999999999998e-8

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + y \cdot \frac{z}{\color{blue}{t}} \]
    6. Step-by-step derivation
      1. lower-/.f6461.7

        \[\leadsto x + y \cdot \frac{z}{t} \]
    7. Applied rewrites61.7%

      \[\leadsto x + y \cdot \frac{z}{\color{blue}{t}} \]
    8. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto x + \color{blue}{y \cdot \frac{z}{t}} \]
      2. +-commutativeN/A

        \[\leadsto y \cdot \frac{z}{t} + \color{blue}{x} \]
      3. add-flipN/A

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

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

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

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

        \[\leadsto \frac{z}{t} \cdot y + x \]
      8. lower-fma.f6461.7

        \[\leadsto \mathsf{fma}\left(\frac{z}{t}, \color{blue}{y}, x\right) \]
    9. Applied rewrites61.7%

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

Alternative 7: 64.5% accurate, 0.4× speedup?

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

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

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot z\\


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

    1. Initial program 76.5%

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

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

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

        \[\leadsto x + -1 \cdot \color{blue}{\frac{a \cdot y - y \cdot z}{t}} \]
      3. lower-/.f64N/A

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{\color{blue}{t}} \]
      4. lower--.f64N/A

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{t} \]
      5. lower-*.f64N/A

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{t} \]
      6. lower-*.f6457.7

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{t} \]
    4. Applied rewrites57.7%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{a \cdot y - y \cdot z}{t}} \]
    5. Taylor expanded in z around inf

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

        \[\leadsto \frac{y \cdot z}{t} \]
      2. lower-*.f6418.6

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

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

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

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

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

        \[\leadsto \frac{z}{t} \cdot y \]
      5. lower-*.f64N/A

        \[\leadsto \frac{z}{t} \cdot y \]
      6. lower-/.f6420.2

        \[\leadsto \frac{z}{t} \cdot y \]
    9. Applied rewrites20.2%

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

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

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right) \]
      4. add-to-fractionN/A

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 \cdot \left(a - t\right) + t\right) \cdot \frac{1}{a - t} - z \cdot \color{blue}{\frac{1}{a - t}}\right) \]
      8. distribute-rgt-out--N/A

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

        \[\leadsto x + y \cdot \left(\frac{1}{a - t} \cdot \left(\left(\left(a - t\right) + t\right) - z\right)\right) \]
      10. sum-to-mult-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{-1}{t - a} \cdot \left(\left(t - \left(t - a\right)\right) - z\right)\right) \cdot y + x \]
      5. lower-fma.f6493.3

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

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

      \[\leadsto \color{blue}{x + y} \]
    10. Step-by-step derivation
      1. lower-+.f6460.2

        \[\leadsto x + \color{blue}{y} \]
    11. Applied rewrites60.2%

      \[\leadsto \color{blue}{x + y} \]

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

    1. Initial program 76.5%

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

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

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

        \[\leadsto x + -1 \cdot \color{blue}{\frac{a \cdot y - y \cdot z}{t}} \]
      3. lower-/.f64N/A

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{\color{blue}{t}} \]
      4. lower--.f64N/A

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{t} \]
      5. lower-*.f64N/A

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{t} \]
      6. lower-*.f6457.7

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{t} \]
    4. Applied rewrites57.7%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{a \cdot y - y \cdot z}{t}} \]
    5. Taylor expanded in z around inf

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

        \[\leadsto \frac{y \cdot z}{t} \]
      2. lower-*.f6418.6

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

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

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

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

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

        \[\leadsto \frac{y}{t} \cdot z \]
      5. lower-*.f6419.9

        \[\leadsto \frac{y}{t} \cdot z \]
    9. Applied rewrites19.9%

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

Alternative 8: 64.4% accurate, 0.4× speedup?

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

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

real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (y / t) * z
    t_2 = (x + y) - (((z - t) * y) / (a - t))
    if (t_2 <= (-2d+306)) then
        tmp = t_1
    else if (t_2 <= 2d+305) then
        tmp = x + y
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (y / t) * z;
	double t_2 = (x + y) - (((z - t) * y) / (a - t));
	double tmp;
	if (t_2 <= -2e+306) {
		tmp = t_1;
	} else if (t_2 <= 2e+305) {
		tmp = x + y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (y / t) * z
	t_2 = (x + y) - (((z - t) * y) / (a - t))
	tmp = 0
	if t_2 <= -2e+306:
		tmp = t_1
	elif t_2 <= 2e+305:
		tmp = x + y
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(y / t) * z)
	t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t)))
	tmp = 0.0
	if (t_2 <= -2e+306)
		tmp = t_1;
	elseif (t_2 <= 2e+305)
		tmp = Float64(x + y);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (y / t) * z;
	t_2 = (x + y) - (((z - t) * y) / (a - t));
	tmp = 0.0;
	if (t_2 <= -2e+306)
		tmp = t_1;
	elseif (t_2 <= 2e+305)
		tmp = x + y;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+306], t$95$1, If[LessEqual[t$95$2, 2e+305], N[(x + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 76.5%

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

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

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

        \[\leadsto x + -1 \cdot \color{blue}{\frac{a \cdot y - y \cdot z}{t}} \]
      3. lower-/.f64N/A

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{\color{blue}{t}} \]
      4. lower--.f64N/A

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{t} \]
      5. lower-*.f64N/A

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{t} \]
      6. lower-*.f6457.7

        \[\leadsto x + -1 \cdot \frac{a \cdot y - y \cdot z}{t} \]
    4. Applied rewrites57.7%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{a \cdot y - y \cdot z}{t}} \]
    5. Taylor expanded in z around inf

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

        \[\leadsto \frac{y \cdot z}{t} \]
      2. lower-*.f6418.6

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

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

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

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

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

        \[\leadsto \frac{y}{t} \cdot z \]
      5. lower-*.f6419.9

        \[\leadsto \frac{y}{t} \cdot z \]
    9. Applied rewrites19.9%

      \[\leadsto \frac{y}{t} \cdot z \]

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

    1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right) \]
      4. add-to-fractionN/A

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

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

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

        \[\leadsto x + y \cdot \left(\left(1 \cdot \left(a - t\right) + t\right) \cdot \frac{1}{a - t} - z \cdot \color{blue}{\frac{1}{a - t}}\right) \]
      8. distribute-rgt-out--N/A

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

        \[\leadsto x + y \cdot \left(\frac{1}{a - t} \cdot \left(\left(\left(a - t\right) + t\right) - z\right)\right) \]
      10. sum-to-mult-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{-1}{t - a} \cdot \left(\left(t - \left(t - a\right)\right) - z\right)\right) \cdot y + x \]
      5. lower-fma.f6493.3

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

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

      \[\leadsto \color{blue}{x + y} \]
    10. Step-by-step derivation
      1. lower-+.f6460.2

        \[\leadsto x + \color{blue}{y} \]
    11. Applied rewrites60.2%

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

Alternative 9: 60.2% accurate, 4.8× speedup?

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

\\
x + y
\end{array}
Derivation
  1. Initial program 76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + y \cdot \left(\left(1 + \frac{t}{a - t}\right) - \frac{z}{a - t}\right) \]
    4. add-to-fractionN/A

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

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

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

      \[\leadsto x + y \cdot \left(\left(1 \cdot \left(a - t\right) + t\right) \cdot \frac{1}{a - t} - z \cdot \color{blue}{\frac{1}{a - t}}\right) \]
    8. distribute-rgt-out--N/A

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

      \[\leadsto x + y \cdot \left(\frac{1}{a - t} \cdot \left(\left(\left(a - t\right) + t\right) - z\right)\right) \]
    10. sum-to-mult-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\frac{-1}{t - a} \cdot \left(\left(t - \left(t - a\right)\right) - z\right)\right) \cdot y + x \]
    5. lower-fma.f6493.3

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

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

    \[\leadsto \color{blue}{x + y} \]
  10. Step-by-step derivation
    1. lower-+.f6460.2

      \[\leadsto x + \color{blue}{y} \]
  11. Applied rewrites60.2%

    \[\leadsto \color{blue}{x + y} \]
  12. Add Preprocessing

Reproduce

?
herbie shell --seed 2025149 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
  :precision binary64
  (- (+ x y) (/ (* (- z t) y) (- a t))))