Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 2.7s
Alternatives: 11
Speedup: 1.1×

Specification

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

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

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

\\
x + \left(y - z\right) \cdot \left(t - x\right)
\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 11 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 100.0% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{y - z}, t - x, x\right) \]
    8. lift--.f64100.0

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

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

Alternative 2: 84.0% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;z \leq -2.7 \cdot 10^{-95}:\\
\;\;\;\;\mathsf{fma}\left(y - z, t, x\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.5000000000000002e99 or 6.5999999999999996e27 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

        \[\leadsto \left(t - x\right) \cdot \left(y - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right) + x \]
      9. fp-cancel-sign-sub-invN/A

        \[\leadsto \left(t - x\right) \cdot \color{blue}{\left(y + -1 \cdot z\right)} + x \]
      10. distribute-rgt-outN/A

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(t - x, y, x + -1 \cdot \left(z \cdot \left(t - x\right)\right)\right)} \]
      16. lift--.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{t - x}, y, x + -1 \cdot \left(z \cdot \left(t - x\right)\right)\right) \]
      17. fp-cancel-sign-sub-invN/A

        \[\leadsto \mathsf{fma}\left(t - x, y, \color{blue}{x - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \left(t - x\right)\right)}\right) \]
      18. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(t - x, y, \color{blue}{x - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \left(t - x\right)\right)}\right) \]
      19. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(t - x, y, x - \color{blue}{1} \cdot \left(z \cdot \left(t - x\right)\right)\right) \]
      20. *-lft-identityN/A

        \[\leadsto \mathsf{fma}\left(t - x, y, x - \color{blue}{z \cdot \left(t - x\right)}\right) \]
      21. *-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(t - x, y, x - \color{blue}{\left(t - x\right) \cdot z}\right) \]
      23. lift--.f6496.0

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

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

      \[\leadsto \color{blue}{z \cdot \left(x - t\right)} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(x - t\right) \cdot \color{blue}{z} \]
      3. lower--.f6483.6

        \[\leadsto \left(x - t\right) \cdot z \]
    6. Applied rewrites83.6%

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

    if -5.5000000000000002e99 < z < -2.7e-95

    1. Initial program 100.0%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{y - z}, t - x, x\right) \]
      8. lift--.f64100.0

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

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

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

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

      if -2.7e-95 < z < 6.5999999999999996e27

      1. Initial program 100.0%

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

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

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

          \[\leadsto \left(t - x\right) \cdot y + x \]
        3. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(t - x, \color{blue}{y}, x\right) \]
        4. lift--.f6490.6

          \[\leadsto \mathsf{fma}\left(t - x, y, x\right) \]
      4. Applied rewrites90.6%

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

    Alternative 3: 83.3% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x - t\right) \cdot z\\ \mathbf{if}\;z \leq -8.2 \cdot 10^{+69}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{+27}:\\ \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (let* ((t_1 (* (- x t) z)))
       (if (<= z -8.2e+69) t_1 (if (<= z 6.6e+27) (fma (- t x) y x) t_1))))
    double code(double x, double y, double z, double t) {
    	double t_1 = (x - t) * z;
    	double tmp;
    	if (z <= -8.2e+69) {
    		tmp = t_1;
    	} else if (z <= 6.6e+27) {
    		tmp = fma((t - x), y, x);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t)
    	t_1 = Float64(Float64(x - t) * z)
    	tmp = 0.0
    	if (z <= -8.2e+69)
    		tmp = t_1;
    	elseif (z <= 6.6e+27)
    		tmp = fma(Float64(t - x), y, x);
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -8.2e+69], t$95$1, If[LessEqual[z, 6.6e+27], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \left(x - t\right) \cdot z\\
    \mathbf{if}\;z \leq -8.2 \cdot 10^{+69}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \leq 6.6 \cdot 10^{+27}:\\
    \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -8.1999999999999998e69 or 6.5999999999999996e27 < z

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

          \[\leadsto \left(t - x\right) \cdot \left(y - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right) + x \]
        9. fp-cancel-sign-sub-invN/A

          \[\leadsto \left(t - x\right) \cdot \color{blue}{\left(y + -1 \cdot z\right)} + x \]
        10. distribute-rgt-outN/A

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(t - x, y, x + -1 \cdot \left(z \cdot \left(t - x\right)\right)\right)} \]
        16. lift--.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{t - x}, y, x + -1 \cdot \left(z \cdot \left(t - x\right)\right)\right) \]
        17. fp-cancel-sign-sub-invN/A

          \[\leadsto \mathsf{fma}\left(t - x, y, \color{blue}{x - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \left(t - x\right)\right)}\right) \]
        18. lower--.f64N/A

          \[\leadsto \mathsf{fma}\left(t - x, y, \color{blue}{x - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \left(t - x\right)\right)}\right) \]
        19. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(t - x, y, x - \color{blue}{1} \cdot \left(z \cdot \left(t - x\right)\right)\right) \]
        20. *-lft-identityN/A

          \[\leadsto \mathsf{fma}\left(t - x, y, x - \color{blue}{z \cdot \left(t - x\right)}\right) \]
        21. *-commutativeN/A

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

          \[\leadsto \mathsf{fma}\left(t - x, y, x - \color{blue}{\left(t - x\right) \cdot z}\right) \]
        23. lift--.f6496.0

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

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

        \[\leadsto \color{blue}{z \cdot \left(x - t\right)} \]
      5. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto \left(x - t\right) \cdot \color{blue}{z} \]
        3. lower--.f6482.7

          \[\leadsto \left(x - t\right) \cdot z \]
      6. Applied rewrites82.7%

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

      if -8.1999999999999998e69 < z < 6.5999999999999996e27

      1. Initial program 100.0%

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

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

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

          \[\leadsto \left(t - x\right) \cdot y + x \]
        3. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(t - x, \color{blue}{y}, x\right) \]
        4. lift--.f6485.1

          \[\leadsto \mathsf{fma}\left(t - x, y, x\right) \]
      4. Applied rewrites85.1%

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

    Alternative 4: 68.3% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x - t\right) \cdot z\\ \mathbf{if}\;z \leq -6.8 \cdot 10^{+93}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-64}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-272}:\\ \;\;\;\;\left(1 - y\right) \cdot x\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{+27}:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (let* ((t_1 (* (- x t) z)))
       (if (<= z -6.8e+93)
         t_1
         (if (<= z -2.6e-64)
           (* (- y z) t)
           (if (<= z 1.25e-272)
             (* (- 1.0 y) x)
             (if (<= z 6.6e+27) (* (- t x) y) t_1))))))
    double code(double x, double y, double z, double t) {
    	double t_1 = (x - t) * z;
    	double tmp;
    	if (z <= -6.8e+93) {
    		tmp = t_1;
    	} else if (z <= -2.6e-64) {
    		tmp = (y - z) * t;
    	} else if (z <= 1.25e-272) {
    		tmp = (1.0 - y) * x;
    	} else if (z <= 6.6e+27) {
    		tmp = (t - 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)
    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) :: t_1
        real(8) :: tmp
        t_1 = (x - t) * z
        if (z <= (-6.8d+93)) then
            tmp = t_1
        else if (z <= (-2.6d-64)) then
            tmp = (y - z) * t
        else if (z <= 1.25d-272) then
            tmp = (1.0d0 - y) * x
        else if (z <= 6.6d+27) then
            tmp = (t - 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 t_1 = (x - t) * z;
    	double tmp;
    	if (z <= -6.8e+93) {
    		tmp = t_1;
    	} else if (z <= -2.6e-64) {
    		tmp = (y - z) * t;
    	} else if (z <= 1.25e-272) {
    		tmp = (1.0 - y) * x;
    	} else if (z <= 6.6e+27) {
    		tmp = (t - x) * y;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t):
    	t_1 = (x - t) * z
    	tmp = 0
    	if z <= -6.8e+93:
    		tmp = t_1
    	elif z <= -2.6e-64:
    		tmp = (y - z) * t
    	elif z <= 1.25e-272:
    		tmp = (1.0 - y) * x
    	elif z <= 6.6e+27:
    		tmp = (t - x) * y
    	else:
    		tmp = t_1
    	return tmp
    
    function code(x, y, z, t)
    	t_1 = Float64(Float64(x - t) * z)
    	tmp = 0.0
    	if (z <= -6.8e+93)
    		tmp = t_1;
    	elseif (z <= -2.6e-64)
    		tmp = Float64(Float64(y - z) * t);
    	elseif (z <= 1.25e-272)
    		tmp = Float64(Float64(1.0 - y) * x);
    	elseif (z <= 6.6e+27)
    		tmp = Float64(Float64(t - x) * y);
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t)
    	t_1 = (x - t) * z;
    	tmp = 0.0;
    	if (z <= -6.8e+93)
    		tmp = t_1;
    	elseif (z <= -2.6e-64)
    		tmp = (y - z) * t;
    	elseif (z <= 1.25e-272)
    		tmp = (1.0 - y) * x;
    	elseif (z <= 6.6e+27)
    		tmp = (t - x) * y;
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -6.8e+93], t$95$1, If[LessEqual[z, -2.6e-64], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 1.25e-272], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 6.6e+27], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := \left(x - t\right) \cdot z\\
    \mathbf{if}\;z \leq -6.8 \cdot 10^{+93}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \leq -2.6 \cdot 10^{-64}:\\
    \;\;\;\;\left(y - z\right) \cdot t\\
    
    \mathbf{elif}\;z \leq 1.25 \cdot 10^{-272}:\\
    \;\;\;\;\left(1 - y\right) \cdot x\\
    
    \mathbf{elif}\;z \leq 6.6 \cdot 10^{+27}:\\
    \;\;\;\;\left(t - x\right) \cdot y\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if z < -6.8000000000000001e93 or 6.5999999999999996e27 < z

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

          \[\leadsto \left(t - x\right) \cdot \left(y - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right) + x \]
        9. fp-cancel-sign-sub-invN/A

          \[\leadsto \left(t - x\right) \cdot \color{blue}{\left(y + -1 \cdot z\right)} + x \]
        10. distribute-rgt-outN/A

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(t - x, y, x + -1 \cdot \left(z \cdot \left(t - x\right)\right)\right)} \]
        16. lift--.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{t - x}, y, x + -1 \cdot \left(z \cdot \left(t - x\right)\right)\right) \]
        17. fp-cancel-sign-sub-invN/A

          \[\leadsto \mathsf{fma}\left(t - x, y, \color{blue}{x - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \left(t - x\right)\right)}\right) \]
        18. lower--.f64N/A

          \[\leadsto \mathsf{fma}\left(t - x, y, \color{blue}{x - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \left(t - x\right)\right)}\right) \]
        19. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(t - x, y, x - \color{blue}{1} \cdot \left(z \cdot \left(t - x\right)\right)\right) \]
        20. *-lft-identityN/A

          \[\leadsto \mathsf{fma}\left(t - x, y, x - \color{blue}{z \cdot \left(t - x\right)}\right) \]
        21. *-commutativeN/A

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

          \[\leadsto \mathsf{fma}\left(t - x, y, x - \color{blue}{\left(t - x\right) \cdot z}\right) \]
        23. lift--.f6496.0

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

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

        \[\leadsto \color{blue}{z \cdot \left(x - t\right)} \]
      5. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto \left(x - t\right) \cdot \color{blue}{z} \]
        3. lower--.f6483.6

          \[\leadsto \left(x - t\right) \cdot z \]
      6. Applied rewrites83.6%

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

      if -6.8000000000000001e93 < z < -2.6e-64

      1. Initial program 100.0%

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

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

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

          \[\leadsto \left(y - z\right) \cdot \color{blue}{t} \]
        3. lift--.f6450.8

          \[\leadsto \left(y - z\right) \cdot t \]
      4. Applied rewrites50.8%

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

      if -2.6e-64 < z < 1.24999999999999995e-272

      1. Initial program 100.0%

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

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

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

          \[\leadsto \left(1 + -1 \cdot \left(y - z\right)\right) \cdot \color{blue}{x} \]
        3. fp-cancel-sign-sub-invN/A

          \[\leadsto \left(1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(y - z\right)\right) \cdot x \]
        4. metadata-evalN/A

          \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
        5. *-lft-identityN/A

          \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
        6. lower--.f64N/A

          \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
        7. lift--.f6462.2

          \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
      4. Applied rewrites62.2%

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

        \[\leadsto \left(1 - y\right) \cdot x \]
      6. Step-by-step derivation
        1. Applied rewrites62.2%

          \[\leadsto \left(1 - y\right) \cdot x \]

        if 1.24999999999999995e-272 < z < 6.5999999999999996e27

        1. Initial program 100.0%

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

          \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
        3. Step-by-step derivation
          1. *-commutativeN/A

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

            \[\leadsto \left(t - x\right) \cdot \color{blue}{y} \]
          3. lift--.f6455.8

            \[\leadsto \left(t - x\right) \cdot y \]
        4. Applied rewrites55.8%

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

      Alternative 5: 67.8% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - x\right) \cdot y\\ \mathbf{if}\;y \leq -4.7:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{-101}:\\ \;\;\;\;\mathsf{fma}\left(-z, t, x\right)\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{+172}:\\ \;\;\;\;\left(x - t\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (let* ((t_1 (* (- t x) y)))
         (if (<= y -4.7)
           t_1
           (if (<= y 4.7e-101)
             (fma (- z) t x)
             (if (<= y 3.4e+172) (* (- x t) z) t_1)))))
      double code(double x, double y, double z, double t) {
      	double t_1 = (t - x) * y;
      	double tmp;
      	if (y <= -4.7) {
      		tmp = t_1;
      	} else if (y <= 4.7e-101) {
      		tmp = fma(-z, t, x);
      	} else if (y <= 3.4e+172) {
      		tmp = (x - t) * z;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	t_1 = Float64(Float64(t - x) * y)
      	tmp = 0.0
      	if (y <= -4.7)
      		tmp = t_1;
      	elseif (y <= 4.7e-101)
      		tmp = fma(Float64(-z), t, x);
      	elseif (y <= 3.4e+172)
      		tmp = Float64(Float64(x - t) * z);
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -4.7], t$95$1, If[LessEqual[y, 4.7e-101], N[((-z) * t + x), $MachinePrecision], If[LessEqual[y, 3.4e+172], N[(N[(x - t), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \left(t - x\right) \cdot y\\
      \mathbf{if}\;y \leq -4.7:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;y \leq 4.7 \cdot 10^{-101}:\\
      \;\;\;\;\mathsf{fma}\left(-z, t, x\right)\\
      
      \mathbf{elif}\;y \leq 3.4 \cdot 10^{+172}:\\
      \;\;\;\;\left(x - t\right) \cdot z\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y < -4.70000000000000018 or 3.3999999999999998e172 < y

        1. Initial program 100.0%

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

          \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
        3. Step-by-step derivation
          1. *-commutativeN/A

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

            \[\leadsto \left(t - x\right) \cdot \color{blue}{y} \]
          3. lift--.f6482.8

            \[\leadsto \left(t - x\right) \cdot y \]
        4. Applied rewrites82.8%

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

        if -4.70000000000000018 < y < 4.6999999999999999e-101

        1. Initial program 100.0%

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{y - z}, t - x, x\right) \]
          8. lift--.f64100.0

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{-1 \cdot z}, t, x\right) \]
          3. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(z\right), t, x\right) \]
            2. lower-neg.f6469.3

              \[\leadsto \mathsf{fma}\left(-z, t, x\right) \]
          4. Applied rewrites69.3%

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

          if 4.6999999999999999e-101 < y < 3.3999999999999998e172

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

              \[\leadsto \left(t - x\right) \cdot \left(y - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right) + x \]
            9. fp-cancel-sign-sub-invN/A

              \[\leadsto \left(t - x\right) \cdot \color{blue}{\left(y + -1 \cdot z\right)} + x \]
            10. distribute-rgt-outN/A

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

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

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

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(t - x, y, x + -1 \cdot \left(z \cdot \left(t - x\right)\right)\right)} \]
            16. lift--.f64N/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{t - x}, y, x + -1 \cdot \left(z \cdot \left(t - x\right)\right)\right) \]
            17. fp-cancel-sign-sub-invN/A

              \[\leadsto \mathsf{fma}\left(t - x, y, \color{blue}{x - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \left(t - x\right)\right)}\right) \]
            18. lower--.f64N/A

              \[\leadsto \mathsf{fma}\left(t - x, y, \color{blue}{x - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(z \cdot \left(t - x\right)\right)}\right) \]
            19. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(t - x, y, x - \color{blue}{1} \cdot \left(z \cdot \left(t - x\right)\right)\right) \]
            20. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(t - x, y, x - \color{blue}{z \cdot \left(t - x\right)}\right) \]
            21. *-commutativeN/A

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

              \[\leadsto \mathsf{fma}\left(t - x, y, x - \color{blue}{\left(t - x\right) \cdot z}\right) \]
            23. lift--.f6499.5

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

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

            \[\leadsto \color{blue}{z \cdot \left(x - t\right)} \]
          5. Step-by-step derivation
            1. *-commutativeN/A

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

              \[\leadsto \left(x - t\right) \cdot \color{blue}{z} \]
            3. lower--.f6444.4

              \[\leadsto \left(x - t\right) \cdot z \]
          6. Applied rewrites44.4%

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

        Alternative 6: 59.2% accurate, 0.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y - z\right) \cdot t\\ \mathbf{if}\;t \leq -8.8 \cdot 10^{-72}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq -4.8 \cdot 10^{-287}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;t \leq 2.4 \cdot 10^{-50}:\\ \;\;\;\;\left(1 - y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (let* ((t_1 (* (- y z) t)))
           (if (<= t -8.8e-72)
             t_1
             (if (<= t -4.8e-287) (* z x) (if (<= t 2.4e-50) (* (- 1.0 y) x) t_1)))))
        double code(double x, double y, double z, double t) {
        	double t_1 = (y - z) * t;
        	double tmp;
        	if (t <= -8.8e-72) {
        		tmp = t_1;
        	} else if (t <= -4.8e-287) {
        		tmp = z * x;
        	} else if (t <= 2.4e-50) {
        		tmp = (1.0 - y) * x;
        	} 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)
        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) :: t_1
            real(8) :: tmp
            t_1 = (y - z) * t
            if (t <= (-8.8d-72)) then
                tmp = t_1
            else if (t <= (-4.8d-287)) then
                tmp = z * x
            else if (t <= 2.4d-50) then
                tmp = (1.0d0 - y) * x
            else
                tmp = t_1
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z, double t) {
        	double t_1 = (y - z) * t;
        	double tmp;
        	if (t <= -8.8e-72) {
        		tmp = t_1;
        	} else if (t <= -4.8e-287) {
        		tmp = z * x;
        	} else if (t <= 2.4e-50) {
        		tmp = (1.0 - y) * x;
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        def code(x, y, z, t):
        	t_1 = (y - z) * t
        	tmp = 0
        	if t <= -8.8e-72:
        		tmp = t_1
        	elif t <= -4.8e-287:
        		tmp = z * x
        	elif t <= 2.4e-50:
        		tmp = (1.0 - y) * x
        	else:
        		tmp = t_1
        	return tmp
        
        function code(x, y, z, t)
        	t_1 = Float64(Float64(y - z) * t)
        	tmp = 0.0
        	if (t <= -8.8e-72)
        		tmp = t_1;
        	elseif (t <= -4.8e-287)
        		tmp = Float64(z * x);
        	elseif (t <= 2.4e-50)
        		tmp = Float64(Float64(1.0 - y) * x);
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z, t)
        	t_1 = (y - z) * t;
        	tmp = 0.0;
        	if (t <= -8.8e-72)
        		tmp = t_1;
        	elseif (t <= -4.8e-287)
        		tmp = z * x;
        	elseif (t <= 2.4e-50)
        		tmp = (1.0 - y) * x;
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -8.8e-72], t$95$1, If[LessEqual[t, -4.8e-287], N[(z * x), $MachinePrecision], If[LessEqual[t, 2.4e-50], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \left(y - z\right) \cdot t\\
        \mathbf{if}\;t \leq -8.8 \cdot 10^{-72}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;t \leq -4.8 \cdot 10^{-287}:\\
        \;\;\;\;z \cdot x\\
        
        \mathbf{elif}\;t \leq 2.4 \cdot 10^{-50}:\\
        \;\;\;\;\left(1 - y\right) \cdot x\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if t < -8.8000000000000001e-72 or 2.40000000000000002e-50 < t

          1. Initial program 100.0%

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

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

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

              \[\leadsto \left(y - z\right) \cdot \color{blue}{t} \]
            3. lift--.f6468.4

              \[\leadsto \left(y - z\right) \cdot t \]
          4. Applied rewrites68.4%

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

          if -8.8000000000000001e-72 < t < -4.79999999999999999e-287

          1. Initial program 100.0%

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

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

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

              \[\leadsto \left(1 + -1 \cdot \left(y - z\right)\right) \cdot \color{blue}{x} \]
            3. fp-cancel-sign-sub-invN/A

              \[\leadsto \left(1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(y - z\right)\right) \cdot x \]
            4. metadata-evalN/A

              \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
            5. *-lft-identityN/A

              \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
            6. lower--.f64N/A

              \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
            7. lift--.f6482.3

              \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
          4. Applied rewrites82.3%

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

            \[\leadsto z \cdot x \]
          6. Step-by-step derivation
            1. Applied rewrites32.6%

              \[\leadsto z \cdot x \]

            if -4.79999999999999999e-287 < t < 2.40000000000000002e-50

            1. Initial program 100.0%

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

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

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

                \[\leadsto \left(1 + -1 \cdot \left(y - z\right)\right) \cdot \color{blue}{x} \]
              3. fp-cancel-sign-sub-invN/A

                \[\leadsto \left(1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(y - z\right)\right) \cdot x \]
              4. metadata-evalN/A

                \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
              5. *-lft-identityN/A

                \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
              6. lower--.f64N/A

                \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
              7. lift--.f6482.9

                \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
            4. Applied rewrites82.9%

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

              \[\leadsto \left(1 - y\right) \cdot x \]
            6. Step-by-step derivation
              1. Applied rewrites55.4%

                \[\leadsto \left(1 - y\right) \cdot x \]
            7. Recombined 3 regimes into one program.
            8. Add Preprocessing

            Alternative 7: 52.1% accurate, 0.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - x\right) \cdot y\\ \mathbf{if}\;z \leq -2.5 \cdot 10^{+124}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-62}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-272}:\\ \;\;\;\;\left(1 - y\right) \cdot x\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{+28}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
            (FPCore (x y z t)
             :precision binary64
             (let* ((t_1 (* (- t x) y)))
               (if (<= z -2.5e+124)
                 (* z x)
                 (if (<= z -2.1e-62)
                   t_1
                   (if (<= z 1.25e-272)
                     (* (- 1.0 y) x)
                     (if (<= z 2.5e+28) t_1 (* z x)))))))
            double code(double x, double y, double z, double t) {
            	double t_1 = (t - x) * y;
            	double tmp;
            	if (z <= -2.5e+124) {
            		tmp = z * x;
            	} else if (z <= -2.1e-62) {
            		tmp = t_1;
            	} else if (z <= 1.25e-272) {
            		tmp = (1.0 - y) * x;
            	} else if (z <= 2.5e+28) {
            		tmp = t_1;
            	} else {
            		tmp = z * x;
            	}
            	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)
            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) :: t_1
                real(8) :: tmp
                t_1 = (t - x) * y
                if (z <= (-2.5d+124)) then
                    tmp = z * x
                else if (z <= (-2.1d-62)) then
                    tmp = t_1
                else if (z <= 1.25d-272) then
                    tmp = (1.0d0 - y) * x
                else if (z <= 2.5d+28) then
                    tmp = t_1
                else
                    tmp = z * x
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z, double t) {
            	double t_1 = (t - x) * y;
            	double tmp;
            	if (z <= -2.5e+124) {
            		tmp = z * x;
            	} else if (z <= -2.1e-62) {
            		tmp = t_1;
            	} else if (z <= 1.25e-272) {
            		tmp = (1.0 - y) * x;
            	} else if (z <= 2.5e+28) {
            		tmp = t_1;
            	} else {
            		tmp = z * x;
            	}
            	return tmp;
            }
            
            def code(x, y, z, t):
            	t_1 = (t - x) * y
            	tmp = 0
            	if z <= -2.5e+124:
            		tmp = z * x
            	elif z <= -2.1e-62:
            		tmp = t_1
            	elif z <= 1.25e-272:
            		tmp = (1.0 - y) * x
            	elif z <= 2.5e+28:
            		tmp = t_1
            	else:
            		tmp = z * x
            	return tmp
            
            function code(x, y, z, t)
            	t_1 = Float64(Float64(t - x) * y)
            	tmp = 0.0
            	if (z <= -2.5e+124)
            		tmp = Float64(z * x);
            	elseif (z <= -2.1e-62)
            		tmp = t_1;
            	elseif (z <= 1.25e-272)
            		tmp = Float64(Float64(1.0 - y) * x);
            	elseif (z <= 2.5e+28)
            		tmp = t_1;
            	else
            		tmp = Float64(z * x);
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z, t)
            	t_1 = (t - x) * y;
            	tmp = 0.0;
            	if (z <= -2.5e+124)
            		tmp = z * x;
            	elseif (z <= -2.1e-62)
            		tmp = t_1;
            	elseif (z <= 1.25e-272)
            		tmp = (1.0 - y) * x;
            	elseif (z <= 2.5e+28)
            		tmp = t_1;
            	else
            		tmp = z * x;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -2.5e+124], N[(z * x), $MachinePrecision], If[LessEqual[z, -2.1e-62], t$95$1, If[LessEqual[z, 1.25e-272], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 2.5e+28], t$95$1, N[(z * x), $MachinePrecision]]]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_1 := \left(t - x\right) \cdot y\\
            \mathbf{if}\;z \leq -2.5 \cdot 10^{+124}:\\
            \;\;\;\;z \cdot x\\
            
            \mathbf{elif}\;z \leq -2.1 \cdot 10^{-62}:\\
            \;\;\;\;t\_1\\
            
            \mathbf{elif}\;z \leq 1.25 \cdot 10^{-272}:\\
            \;\;\;\;\left(1 - y\right) \cdot x\\
            
            \mathbf{elif}\;z \leq 2.5 \cdot 10^{+28}:\\
            \;\;\;\;t\_1\\
            
            \mathbf{else}:\\
            \;\;\;\;z \cdot x\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if z < -2.4999999999999998e124 or 2.49999999999999979e28 < z

              1. Initial program 100.0%

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

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

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

                  \[\leadsto \left(1 + -1 \cdot \left(y - z\right)\right) \cdot \color{blue}{x} \]
                3. fp-cancel-sign-sub-invN/A

                  \[\leadsto \left(1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(y - z\right)\right) \cdot x \]
                4. metadata-evalN/A

                  \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
                5. *-lft-identityN/A

                  \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                6. lower--.f64N/A

                  \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                7. lift--.f6454.1

                  \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
              4. Applied rewrites54.1%

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

                \[\leadsto z \cdot x \]
              6. Step-by-step derivation
                1. Applied rewrites45.6%

                  \[\leadsto z \cdot x \]

                if -2.4999999999999998e124 < z < -2.0999999999999999e-62 or 1.24999999999999995e-272 < z < 2.49999999999999979e28

                1. Initial program 100.0%

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

                  \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
                3. Step-by-step derivation
                  1. *-commutativeN/A

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

                    \[\leadsto \left(t - x\right) \cdot \color{blue}{y} \]
                  3. lift--.f6452.5

                    \[\leadsto \left(t - x\right) \cdot y \]
                4. Applied rewrites52.5%

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

                if -2.0999999999999999e-62 < z < 1.24999999999999995e-272

                1. Initial program 100.0%

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

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

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

                    \[\leadsto \left(1 + -1 \cdot \left(y - z\right)\right) \cdot \color{blue}{x} \]
                  3. fp-cancel-sign-sub-invN/A

                    \[\leadsto \left(1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(y - z\right)\right) \cdot x \]
                  4. metadata-evalN/A

                    \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
                  5. *-lft-identityN/A

                    \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                  6. lower--.f64N/A

                    \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                  7. lift--.f6462.1

                    \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                4. Applied rewrites62.1%

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

                  \[\leadsto \left(1 - y\right) \cdot x \]
                6. Step-by-step derivation
                  1. Applied rewrites62.1%

                    \[\leadsto \left(1 - y\right) \cdot x \]
                7. Recombined 3 regimes into one program.
                8. Add Preprocessing

                Alternative 8: 50.0% accurate, 0.8× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+123}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+27}:\\ \;\;\;\;\left(1 - y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
                (FPCore (x y z t)
                 :precision binary64
                 (if (<= z -1.2e+123) (* z x) (if (<= z 6e+27) (* (- 1.0 y) x) (* z x))))
                double code(double x, double y, double z, double t) {
                	double tmp;
                	if (z <= -1.2e+123) {
                		tmp = z * x;
                	} else if (z <= 6e+27) {
                		tmp = (1.0 - y) * x;
                	} else {
                		tmp = z * x;
                	}
                	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)
                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) :: tmp
                    if (z <= (-1.2d+123)) then
                        tmp = z * x
                    else if (z <= 6d+27) then
                        tmp = (1.0d0 - y) * x
                    else
                        tmp = z * x
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z, double t) {
                	double tmp;
                	if (z <= -1.2e+123) {
                		tmp = z * x;
                	} else if (z <= 6e+27) {
                		tmp = (1.0 - y) * x;
                	} else {
                		tmp = z * x;
                	}
                	return tmp;
                }
                
                def code(x, y, z, t):
                	tmp = 0
                	if z <= -1.2e+123:
                		tmp = z * x
                	elif z <= 6e+27:
                		tmp = (1.0 - y) * x
                	else:
                		tmp = z * x
                	return tmp
                
                function code(x, y, z, t)
                	tmp = 0.0
                	if (z <= -1.2e+123)
                		tmp = Float64(z * x);
                	elseif (z <= 6e+27)
                		tmp = Float64(Float64(1.0 - y) * x);
                	else
                		tmp = Float64(z * x);
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z, t)
                	tmp = 0.0;
                	if (z <= -1.2e+123)
                		tmp = z * x;
                	elseif (z <= 6e+27)
                		tmp = (1.0 - y) * x;
                	else
                		tmp = z * x;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_, t_] := If[LessEqual[z, -1.2e+123], N[(z * x), $MachinePrecision], If[LessEqual[z, 6e+27], N[(N[(1.0 - y), $MachinePrecision] * x), $MachinePrecision], N[(z * x), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;z \leq -1.2 \cdot 10^{+123}:\\
                \;\;\;\;z \cdot x\\
                
                \mathbf{elif}\;z \leq 6 \cdot 10^{+27}:\\
                \;\;\;\;\left(1 - y\right) \cdot x\\
                
                \mathbf{else}:\\
                \;\;\;\;z \cdot x\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if z < -1.19999999999999994e123 or 5.99999999999999953e27 < z

                  1. Initial program 100.0%

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

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

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

                      \[\leadsto \left(1 + -1 \cdot \left(y - z\right)\right) \cdot \color{blue}{x} \]
                    3. fp-cancel-sign-sub-invN/A

                      \[\leadsto \left(1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(y - z\right)\right) \cdot x \]
                    4. metadata-evalN/A

                      \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
                    5. *-lft-identityN/A

                      \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                    6. lower--.f64N/A

                      \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                    7. lift--.f6454.1

                      \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                  4. Applied rewrites54.1%

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

                    \[\leadsto z \cdot x \]
                  6. Step-by-step derivation
                    1. Applied rewrites45.5%

                      \[\leadsto z \cdot x \]

                    if -1.19999999999999994e123 < z < 5.99999999999999953e27

                    1. Initial program 100.0%

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

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

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

                        \[\leadsto \left(1 + -1 \cdot \left(y - z\right)\right) \cdot \color{blue}{x} \]
                      3. fp-cancel-sign-sub-invN/A

                        \[\leadsto \left(1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(y - z\right)\right) \cdot x \]
                      4. metadata-evalN/A

                        \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
                      5. *-lft-identityN/A

                        \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                      6. lower--.f64N/A

                        \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                      7. lift--.f6458.8

                        \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                    4. Applied rewrites58.8%

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

                      \[\leadsto \left(1 - y\right) \cdot x \]
                    6. Step-by-step derivation
                      1. Applied rewrites52.8%

                        \[\leadsto \left(1 - y\right) \cdot x \]
                    7. Recombined 2 regimes into one program.
                    8. Add Preprocessing

                    Alternative 9: 38.5% accurate, 0.6× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+99}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-62}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-179}:\\ \;\;\;\;1 \cdot x\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{+27}:\\ \;\;\;\;t \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
                    (FPCore (x y z t)
                     :precision binary64
                     (if (<= z -5.5e+99)
                       (* z x)
                       (if (<= z -2.1e-62)
                         (* t y)
                         (if (<= z 8.2e-179) (* 1.0 x) (if (<= z 2.2e+27) (* t y) (* z x))))))
                    double code(double x, double y, double z, double t) {
                    	double tmp;
                    	if (z <= -5.5e+99) {
                    		tmp = z * x;
                    	} else if (z <= -2.1e-62) {
                    		tmp = t * y;
                    	} else if (z <= 8.2e-179) {
                    		tmp = 1.0 * x;
                    	} else if (z <= 2.2e+27) {
                    		tmp = t * y;
                    	} else {
                    		tmp = z * x;
                    	}
                    	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)
                    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) :: tmp
                        if (z <= (-5.5d+99)) then
                            tmp = z * x
                        else if (z <= (-2.1d-62)) then
                            tmp = t * y
                        else if (z <= 8.2d-179) then
                            tmp = 1.0d0 * x
                        else if (z <= 2.2d+27) then
                            tmp = t * y
                        else
                            tmp = z * x
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double x, double y, double z, double t) {
                    	double tmp;
                    	if (z <= -5.5e+99) {
                    		tmp = z * x;
                    	} else if (z <= -2.1e-62) {
                    		tmp = t * y;
                    	} else if (z <= 8.2e-179) {
                    		tmp = 1.0 * x;
                    	} else if (z <= 2.2e+27) {
                    		tmp = t * y;
                    	} else {
                    		tmp = z * x;
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y, z, t):
                    	tmp = 0
                    	if z <= -5.5e+99:
                    		tmp = z * x
                    	elif z <= -2.1e-62:
                    		tmp = t * y
                    	elif z <= 8.2e-179:
                    		tmp = 1.0 * x
                    	elif z <= 2.2e+27:
                    		tmp = t * y
                    	else:
                    		tmp = z * x
                    	return tmp
                    
                    function code(x, y, z, t)
                    	tmp = 0.0
                    	if (z <= -5.5e+99)
                    		tmp = Float64(z * x);
                    	elseif (z <= -2.1e-62)
                    		tmp = Float64(t * y);
                    	elseif (z <= 8.2e-179)
                    		tmp = Float64(1.0 * x);
                    	elseif (z <= 2.2e+27)
                    		tmp = Float64(t * y);
                    	else
                    		tmp = Float64(z * x);
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y, z, t)
                    	tmp = 0.0;
                    	if (z <= -5.5e+99)
                    		tmp = z * x;
                    	elseif (z <= -2.1e-62)
                    		tmp = t * y;
                    	elseif (z <= 8.2e-179)
                    		tmp = 1.0 * x;
                    	elseif (z <= 2.2e+27)
                    		tmp = t * y;
                    	else
                    		tmp = z * x;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_, z_, t_] := If[LessEqual[z, -5.5e+99], N[(z * x), $MachinePrecision], If[LessEqual[z, -2.1e-62], N[(t * y), $MachinePrecision], If[LessEqual[z, 8.2e-179], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 2.2e+27], N[(t * y), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;z \leq -5.5 \cdot 10^{+99}:\\
                    \;\;\;\;z \cdot x\\
                    
                    \mathbf{elif}\;z \leq -2.1 \cdot 10^{-62}:\\
                    \;\;\;\;t \cdot y\\
                    
                    \mathbf{elif}\;z \leq 8.2 \cdot 10^{-179}:\\
                    \;\;\;\;1 \cdot x\\
                    
                    \mathbf{elif}\;z \leq 2.2 \cdot 10^{+27}:\\
                    \;\;\;\;t \cdot y\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;z \cdot x\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if z < -5.5000000000000002e99 or 2.1999999999999999e27 < z

                      1. Initial program 100.0%

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

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

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

                          \[\leadsto \left(1 + -1 \cdot \left(y - z\right)\right) \cdot \color{blue}{x} \]
                        3. fp-cancel-sign-sub-invN/A

                          \[\leadsto \left(1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(y - z\right)\right) \cdot x \]
                        4. metadata-evalN/A

                          \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
                        5. *-lft-identityN/A

                          \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                        6. lower--.f64N/A

                          \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                        7. lift--.f6454.0

                          \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                      4. Applied rewrites54.0%

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

                        \[\leadsto z \cdot x \]
                      6. Step-by-step derivation
                        1. Applied rewrites45.1%

                          \[\leadsto z \cdot x \]

                        if -5.5000000000000002e99 < z < -2.0999999999999999e-62 or 8.2e-179 < z < 2.1999999999999999e27

                        1. Initial program 100.0%

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

                          \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
                        3. Step-by-step derivation
                          1. *-commutativeN/A

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

                            \[\leadsto \left(t - x\right) \cdot \color{blue}{y} \]
                          3. lift--.f6452.3

                            \[\leadsto \left(t - x\right) \cdot y \]
                        4. Applied rewrites52.3%

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

                          \[\leadsto t \cdot y \]
                        6. Step-by-step derivation
                          1. Applied rewrites29.4%

                            \[\leadsto t \cdot y \]

                          if -2.0999999999999999e-62 < z < 8.2e-179

                          1. Initial program 100.0%

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

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

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

                              \[\leadsto \left(1 + -1 \cdot \left(y - z\right)\right) \cdot \color{blue}{x} \]
                            3. fp-cancel-sign-sub-invN/A

                              \[\leadsto \left(1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(y - z\right)\right) \cdot x \]
                            4. metadata-evalN/A

                              \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
                            5. *-lft-identityN/A

                              \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                            6. lower--.f64N/A

                              \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                            7. lift--.f6463.0

                              \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                          4. Applied rewrites63.0%

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

                            \[\leadsto \left(1 + z\right) \cdot x \]
                          6. Step-by-step derivation
                            1. lower-+.f6438.7

                              \[\leadsto \left(1 + z\right) \cdot x \]
                          7. Applied rewrites38.7%

                            \[\leadsto \left(1 + z\right) \cdot x \]
                          8. Taylor expanded in z around 0

                            \[\leadsto 1 \cdot x \]
                          9. Step-by-step derivation
                            1. Applied rewrites38.7%

                              \[\leadsto 1 \cdot x \]
                          10. Recombined 3 regimes into one program.
                          11. Add Preprocessing

                          Alternative 10: 38.3% accurate, 1.0× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3100000:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{-6}:\\ \;\;\;\;1 \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
                          (FPCore (x y z t)
                           :precision binary64
                           (if (<= z -3100000.0) (* z x) (if (<= z 3.7e-6) (* 1.0 x) (* z x))))
                          double code(double x, double y, double z, double t) {
                          	double tmp;
                          	if (z <= -3100000.0) {
                          		tmp = z * x;
                          	} else if (z <= 3.7e-6) {
                          		tmp = 1.0 * x;
                          	} else {
                          		tmp = z * x;
                          	}
                          	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)
                          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) :: tmp
                              if (z <= (-3100000.0d0)) then
                                  tmp = z * x
                              else if (z <= 3.7d-6) then
                                  tmp = 1.0d0 * x
                              else
                                  tmp = z * x
                              end if
                              code = tmp
                          end function
                          
                          public static double code(double x, double y, double z, double t) {
                          	double tmp;
                          	if (z <= -3100000.0) {
                          		tmp = z * x;
                          	} else if (z <= 3.7e-6) {
                          		tmp = 1.0 * x;
                          	} else {
                          		tmp = z * x;
                          	}
                          	return tmp;
                          }
                          
                          def code(x, y, z, t):
                          	tmp = 0
                          	if z <= -3100000.0:
                          		tmp = z * x
                          	elif z <= 3.7e-6:
                          		tmp = 1.0 * x
                          	else:
                          		tmp = z * x
                          	return tmp
                          
                          function code(x, y, z, t)
                          	tmp = 0.0
                          	if (z <= -3100000.0)
                          		tmp = Float64(z * x);
                          	elseif (z <= 3.7e-6)
                          		tmp = Float64(1.0 * x);
                          	else
                          		tmp = Float64(z * x);
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(x, y, z, t)
                          	tmp = 0.0;
                          	if (z <= -3100000.0)
                          		tmp = z * x;
                          	elseif (z <= 3.7e-6)
                          		tmp = 1.0 * x;
                          	else
                          		tmp = z * x;
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[x_, y_, z_, t_] := If[LessEqual[z, -3100000.0], N[(z * x), $MachinePrecision], If[LessEqual[z, 3.7e-6], N[(1.0 * x), $MachinePrecision], N[(z * x), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;z \leq -3100000:\\
                          \;\;\;\;z \cdot x\\
                          
                          \mathbf{elif}\;z \leq 3.7 \cdot 10^{-6}:\\
                          \;\;\;\;1 \cdot x\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;z \cdot x\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if z < -3.1e6 or 3.7000000000000002e-6 < z

                            1. Initial program 100.0%

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

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

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

                                \[\leadsto \left(1 + -1 \cdot \left(y - z\right)\right) \cdot \color{blue}{x} \]
                              3. fp-cancel-sign-sub-invN/A

                                \[\leadsto \left(1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(y - z\right)\right) \cdot x \]
                              4. metadata-evalN/A

                                \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
                              5. *-lft-identityN/A

                                \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                              6. lower--.f64N/A

                                \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                              7. lift--.f6453.4

                                \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                            4. Applied rewrites53.4%

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

                              \[\leadsto z \cdot x \]
                            6. Step-by-step derivation
                              1. Applied rewrites41.8%

                                \[\leadsto z \cdot x \]

                              if -3.1e6 < z < 3.7000000000000002e-6

                              1. Initial program 100.0%

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

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

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

                                  \[\leadsto \left(1 + -1 \cdot \left(y - z\right)\right) \cdot \color{blue}{x} \]
                                3. fp-cancel-sign-sub-invN/A

                                  \[\leadsto \left(1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(y - z\right)\right) \cdot x \]
                                4. metadata-evalN/A

                                  \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
                                5. *-lft-identityN/A

                                  \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                                6. lower--.f64N/A

                                  \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                                7. lift--.f6460.6

                                  \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                              4. Applied rewrites60.6%

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

                                \[\leadsto \left(1 + z\right) \cdot x \]
                              6. Step-by-step derivation
                                1. lower-+.f6435.5

                                  \[\leadsto \left(1 + z\right) \cdot x \]
                              7. Applied rewrites35.5%

                                \[\leadsto \left(1 + z\right) \cdot x \]
                              8. Taylor expanded in z around 0

                                \[\leadsto 1 \cdot x \]
                              9. Step-by-step derivation
                                1. Applied rewrites34.9%

                                  \[\leadsto 1 \cdot x \]
                              10. Recombined 2 regimes into one program.
                              11. Add Preprocessing

                              Alternative 11: 22.4% accurate, 3.0× speedup?

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

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

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

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

                                  \[\leadsto \left(1 + -1 \cdot \left(y - z\right)\right) \cdot \color{blue}{x} \]
                                3. fp-cancel-sign-sub-invN/A

                                  \[\leadsto \left(1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(y - z\right)\right) \cdot x \]
                                4. metadata-evalN/A

                                  \[\leadsto \left(1 - 1 \cdot \left(y - z\right)\right) \cdot x \]
                                5. *-lft-identityN/A

                                  \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                                6. lower--.f64N/A

                                  \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                                7. lift--.f6457.0

                                  \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                              4. Applied rewrites57.0%

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

                                \[\leadsto z \cdot x \]
                              6. Step-by-step derivation
                                1. Applied rewrites22.4%

                                  \[\leadsto z \cdot x \]
                                2. Add Preprocessing

                                Reproduce

                                ?
                                herbie shell --seed 2025111 
                                (FPCore (x y z t)
                                  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
                                  :precision binary64
                                  (+ x (* (- y z) (- t x))))