Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 5.2s
Alternatives: 11
Speedup: 1.2×

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}

Sampling outcomes in binary64 precision:

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.2× 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. Add Preprocessing
  3. Step-by-step derivation
    1. lift-+.f64N/A

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

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

      \[\leadsto \color{blue}{\left(y - z\right) \cdot \left(t - x\right)} + x \]
    4. lower-fma.f64100.0

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

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

Alternative 2: 71.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x - t\right) \cdot z\\ \mathbf{if}\;z \leq -2.1 \cdot 10^{+79}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{-20}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-154}:\\ \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\ \mathbf{elif}\;z \leq 10^{+34}:\\ \;\;\;\;\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 -2.1e+79)
     t_1
     (if (<= z -2.4e-20)
       (* (- y z) t)
       (if (<= z 6e-154) (fma t y x) (if (<= z 1e+34) (* (- 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 <= -2.1e+79) {
		tmp = t_1;
	} else if (z <= -2.4e-20) {
		tmp = (y - z) * t;
	} else if (z <= 6e-154) {
		tmp = fma(t, y, x);
	} else if (z <= 1e+34) {
		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 <= -2.1e+79)
		tmp = t_1;
	elseif (z <= -2.4e-20)
		tmp = Float64(Float64(y - z) * t);
	elseif (z <= 6e-154)
		tmp = fma(t, y, x);
	elseif (z <= 1e+34)
		tmp = Float64(Float64(t - x) * y);
	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, -2.1e+79], t$95$1, If[LessEqual[z, -2.4e-20], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 6e-154], N[(t * y + x), $MachinePrecision], If[LessEqual[z, 1e+34], 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 -2.1 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -2.4 \cdot 10^{-20}:\\
\;\;\;\;\left(y - z\right) \cdot t\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.10000000000000008e79 or 9.99999999999999946e33 < z

    1. Initial program 100.0%

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

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

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

        \[\leadsto \color{blue}{\left(y - z\right) \cdot \left(t - x\right)} + x \]
      4. lower-fma.f64100.0

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

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

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

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

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

        \[\leadsto \left(-1 \cdot \left(t - x\right)\right) \cdot \color{blue}{z} \]
      4. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(t - x\right)\right)\right) \cdot z \]
      5. *-lft-identityN/A

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

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

        \[\leadsto \left(\mathsf{neg}\left(\left(t + -1 \cdot x\right)\right)\right) \cdot z \]
      8. +-commutativeN/A

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

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

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

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

        \[\leadsto \left(x + -1 \cdot t\right) \cdot z \]
      13. metadata-evalN/A

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

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

        \[\leadsto \left(x - t\right) \cdot z \]
      16. lower--.f6484.2

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

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

    if -2.10000000000000008e79 < z < -2.39999999999999993e-20

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{t \cdot \left(y - z\right)} \]
    4. 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. lower--.f6478.6

        \[\leadsto \left(y - z\right) \cdot t \]
    5. Applied rewrites78.6%

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

    if -2.39999999999999993e-20 < z < 6.0000000000000005e-154

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x + y \cdot \left(t - x\right)} \]
    4. 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. lower--.f6495.0

        \[\leadsto \mathsf{fma}\left(t - x, y, x\right) \]
    5. Applied rewrites95.0%

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

      \[\leadsto \mathsf{fma}\left(t, y, x\right) \]
    7. Step-by-step derivation
      1. Applied rewrites73.9%

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

      if 6.0000000000000005e-154 < z < 9.99999999999999946e33

      1. Initial program 100.0%

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

        \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
      4. 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. lower--.f6471.8

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

        \[\leadsto \color{blue}{\left(t - x\right) \cdot y} \]
    8. Recombined 4 regimes into one program.
    9. Final simplification78.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{+79}:\\ \;\;\;\;\left(x - t\right) \cdot z\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{-20}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-154}:\\ \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\ \mathbf{elif}\;z \leq 10^{+34}:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(x - t\right) \cdot z\\ \end{array} \]
    10. Add Preprocessing

    Alternative 3: 38.4% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.15 \cdot 10^{+79}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-141}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;z \leq -4.55 \cdot 10^{-243}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+54}:\\ \;\;\;\;t \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (if (<= z -2.15e+79)
       (* x z)
       (if (<= z -3.8e-141)
         (* t y)
         (if (<= z -4.55e-243) x (if (<= z 1.9e+54) (* t y) (* x z))))))
    double code(double x, double y, double z, double t) {
    	double tmp;
    	if (z <= -2.15e+79) {
    		tmp = x * z;
    	} else if (z <= -3.8e-141) {
    		tmp = t * y;
    	} else if (z <= -4.55e-243) {
    		tmp = x;
    	} else if (z <= 1.9e+54) {
    		tmp = t * y;
    	} else {
    		tmp = x * z;
    	}
    	return tmp;
    }
    
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(x, y, z, t)
    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 <= (-2.15d+79)) then
            tmp = x * z
        else if (z <= (-3.8d-141)) then
            tmp = t * y
        else if (z <= (-4.55d-243)) then
            tmp = x
        else if (z <= 1.9d+54) then
            tmp = t * y
        else
            tmp = x * z
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t) {
    	double tmp;
    	if (z <= -2.15e+79) {
    		tmp = x * z;
    	} else if (z <= -3.8e-141) {
    		tmp = t * y;
    	} else if (z <= -4.55e-243) {
    		tmp = x;
    	} else if (z <= 1.9e+54) {
    		tmp = t * y;
    	} else {
    		tmp = x * z;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t):
    	tmp = 0
    	if z <= -2.15e+79:
    		tmp = x * z
    	elif z <= -3.8e-141:
    		tmp = t * y
    	elif z <= -4.55e-243:
    		tmp = x
    	elif z <= 1.9e+54:
    		tmp = t * y
    	else:
    		tmp = x * z
    	return tmp
    
    function code(x, y, z, t)
    	tmp = 0.0
    	if (z <= -2.15e+79)
    		tmp = Float64(x * z);
    	elseif (z <= -3.8e-141)
    		tmp = Float64(t * y);
    	elseif (z <= -4.55e-243)
    		tmp = x;
    	elseif (z <= 1.9e+54)
    		tmp = Float64(t * y);
    	else
    		tmp = Float64(x * z);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t)
    	tmp = 0.0;
    	if (z <= -2.15e+79)
    		tmp = x * z;
    	elseif (z <= -3.8e-141)
    		tmp = t * y;
    	elseif (z <= -4.55e-243)
    		tmp = x;
    	elseif (z <= 1.9e+54)
    		tmp = t * y;
    	else
    		tmp = x * z;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_] := If[LessEqual[z, -2.15e+79], N[(x * z), $MachinePrecision], If[LessEqual[z, -3.8e-141], N[(t * y), $MachinePrecision], If[LessEqual[z, -4.55e-243], x, If[LessEqual[z, 1.9e+54], N[(t * y), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq -2.15 \cdot 10^{+79}:\\
    \;\;\;\;x \cdot z\\
    
    \mathbf{elif}\;z \leq -3.8 \cdot 10^{-141}:\\
    \;\;\;\;t \cdot y\\
    
    \mathbf{elif}\;z \leq -4.55 \cdot 10^{-243}:\\
    \;\;\;\;x\\
    
    \mathbf{elif}\;z \leq 1.9 \cdot 10^{+54}:\\
    \;\;\;\;t \cdot y\\
    
    \mathbf{else}:\\
    \;\;\;\;x \cdot z\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z < -2.1500000000000002e79 or 1.9000000000000001e54 < z

      1. Initial program 100.0%

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

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

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

          \[\leadsto \color{blue}{\left(y - z\right) \cdot \left(t - x\right)} + x \]
        4. lower-fma.f64100.0

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

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

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

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

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

          \[\leadsto \left(-1 \cdot \left(t - x\right)\right) \cdot \color{blue}{z} \]
        4. mul-1-negN/A

          \[\leadsto \left(\mathsf{neg}\left(\left(t - x\right)\right)\right) \cdot z \]
        5. *-lft-identityN/A

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

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

          \[\leadsto \left(\mathsf{neg}\left(\left(t + -1 \cdot x\right)\right)\right) \cdot z \]
        8. +-commutativeN/A

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

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

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

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

          \[\leadsto \left(x + -1 \cdot t\right) \cdot z \]
        13. metadata-evalN/A

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

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

          \[\leadsto \left(x - t\right) \cdot z \]
        16. lower--.f6485.0

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

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

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

          \[\leadsto x \cdot z \]

        if -2.1500000000000002e79 < z < -3.79999999999999987e-141 or -4.55000000000000009e-243 < z < 1.9000000000000001e54

        1. Initial program 99.9%

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

          \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
        4. 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. lower--.f6463.6

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

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

          \[\leadsto t \cdot y \]
        7. Step-by-step derivation
          1. Applied rewrites40.1%

            \[\leadsto t \cdot y \]

          if -3.79999999999999987e-141 < z < -4.55000000000000009e-243

          1. Initial program 100.0%

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

            \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
          4. Step-by-step derivation
            1. associate-*r*N/A

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

              \[\leadsto x + \left(\mathsf{neg}\left(z\right)\right) \cdot \left(\color{blue}{t} - x\right) \]
            3. fp-cancel-sub-signN/A

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

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

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

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

              \[\leadsto x - \left(t - x\right) \cdot z \]
          5. Applied rewrites66.8%

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

            \[\leadsto x \]
          7. Step-by-step derivation
            1. Applied rewrites62.7%

              \[\leadsto x \]
          8. Recombined 3 regimes into one program.
          9. Final simplification46.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.15 \cdot 10^{+79}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{-141}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;z \leq -4.55 \cdot 10^{-243}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+54}:\\ \;\;\;\;t \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
          10. Add Preprocessing

          Alternative 4: 83.4% accurate, 0.5× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x - t\right) \cdot z\\ \mathbf{if}\;z \leq -2.1 \cdot 10^{+79}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{-10}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq 10^{+34}:\\ \;\;\;\;\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 -2.1e+79)
               t_1
               (if (<= z -1.35e-10)
                 (* (- y z) t)
                 (if (<= z 1e+34) (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 <= -2.1e+79) {
          		tmp = t_1;
          	} else if (z <= -1.35e-10) {
          		tmp = (y - z) * t;
          	} else if (z <= 1e+34) {
          		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 <= -2.1e+79)
          		tmp = t_1;
          	elseif (z <= -1.35e-10)
          		tmp = Float64(Float64(y - z) * t);
          	elseif (z <= 1e+34)
          		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, -2.1e+79], t$95$1, If[LessEqual[z, -1.35e-10], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 1e+34], 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 -2.1 \cdot 10^{+79}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;z \leq -1.35 \cdot 10^{-10}:\\
          \;\;\;\;\left(y - z\right) \cdot t\\
          
          \mathbf{elif}\;z \leq 10^{+34}:\\
          \;\;\;\;\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 < -2.10000000000000008e79 or 9.99999999999999946e33 < z

            1. Initial program 100.0%

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

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

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

                \[\leadsto \color{blue}{\left(y - z\right) \cdot \left(t - x\right)} + x \]
              4. lower-fma.f64100.0

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

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

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

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

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

                \[\leadsto \left(-1 \cdot \left(t - x\right)\right) \cdot \color{blue}{z} \]
              4. mul-1-negN/A

                \[\leadsto \left(\mathsf{neg}\left(\left(t - x\right)\right)\right) \cdot z \]
              5. *-lft-identityN/A

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

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

                \[\leadsto \left(\mathsf{neg}\left(\left(t + -1 \cdot x\right)\right)\right) \cdot z \]
              8. +-commutativeN/A

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

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

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

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

                \[\leadsto \left(x + -1 \cdot t\right) \cdot z \]
              13. metadata-evalN/A

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

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

                \[\leadsto \left(x - t\right) \cdot z \]
              16. lower--.f6484.2

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

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

            if -2.10000000000000008e79 < z < -1.35e-10

            1. Initial program 99.9%

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

              \[\leadsto \color{blue}{t \cdot \left(y - z\right)} \]
            4. 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. lower--.f6481.8

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

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

            if -1.35e-10 < z < 9.99999999999999946e33

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{x + y \cdot \left(t - x\right)} \]
            4. 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. lower--.f6492.5

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{+79}:\\ \;\;\;\;\left(x - t\right) \cdot z\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{-10}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq 10^{+34}:\\ \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - t\right) \cdot z\\ \end{array} \]
          5. Add Preprocessing

          Alternative 5: 67.7% accurate, 0.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - x\right) \cdot y\\ \mathbf{if}\;y \leq -1.2 \cdot 10^{+40}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -1.05 \cdot 10^{-19}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+32}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
          (FPCore (x y z t)
           :precision binary64
           (let* ((t_1 (* (- t x) y)))
             (if (<= y -1.2e+40)
               t_1
               (if (<= y -1.05e-19) (* (- y z) t) (if (<= y 6.5e+32) (fma x z x) t_1)))))
          double code(double x, double y, double z, double t) {
          	double t_1 = (t - x) * y;
          	double tmp;
          	if (y <= -1.2e+40) {
          		tmp = t_1;
          	} else if (y <= -1.05e-19) {
          		tmp = (y - z) * t;
          	} else if (y <= 6.5e+32) {
          		tmp = fma(x, z, x);
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          function code(x, y, z, t)
          	t_1 = Float64(Float64(t - x) * y)
          	tmp = 0.0
          	if (y <= -1.2e+40)
          		tmp = t_1;
          	elseif (y <= -1.05e-19)
          		tmp = Float64(Float64(y - z) * t);
          	elseif (y <= 6.5e+32)
          		tmp = fma(x, z, x);
          	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, -1.2e+40], t$95$1, If[LessEqual[y, -1.05e-19], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[y, 6.5e+32], N[(x * z + x), $MachinePrecision], t$95$1]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_1 := \left(t - x\right) \cdot y\\
          \mathbf{if}\;y \leq -1.2 \cdot 10^{+40}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;y \leq -1.05 \cdot 10^{-19}:\\
          \;\;\;\;\left(y - z\right) \cdot t\\
          
          \mathbf{elif}\;y \leq 6.5 \cdot 10^{+32}:\\
          \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_1\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if y < -1.2e40 or 6.4999999999999994e32 < y

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
            4. 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. lower--.f6482.7

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

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

            if -1.2e40 < y < -1.0499999999999999e-19

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{t \cdot \left(y - z\right)} \]
            4. 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. lower--.f6482.4

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

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

            if -1.0499999999999999e-19 < y < 6.4999999999999994e32

            1. Initial program 99.9%

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

              \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
            4. Step-by-step derivation
              1. associate-*r*N/A

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

                \[\leadsto x + \left(\mathsf{neg}\left(z\right)\right) \cdot \left(\color{blue}{t} - x\right) \]
              3. fp-cancel-sub-signN/A

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

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

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

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

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

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

              \[\leadsto x \cdot \color{blue}{\left(1 - -1 \cdot z\right)} \]
            7. Step-by-step derivation
              1. distribute-rgt-out--N/A

                \[\leadsto 1 \cdot x - \left(-1 \cdot z\right) \cdot \color{blue}{x} \]
              2. *-lft-identityN/A

                \[\leadsto x - \left(-1 \cdot z\right) \cdot x \]
              3. mul-1-negN/A

                \[\leadsto x - \left(\mathsf{neg}\left(z\right)\right) \cdot x \]
              4. fp-cancel-sign-subN/A

                \[\leadsto x + z \cdot \color{blue}{x} \]
              5. *-commutativeN/A

                \[\leadsto x + x \cdot z \]
              6. +-commutativeN/A

                \[\leadsto x \cdot z + x \]
              7. lower-fma.f6461.5

                \[\leadsto \mathsf{fma}\left(x, z, x\right) \]
            8. Applied rewrites61.5%

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{z}, x\right) \]
          3. Recombined 3 regimes into one program.
          4. Final simplification72.4%

            \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.2 \cdot 10^{+40}:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{elif}\;y \leq -1.05 \cdot 10^{-19}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+32}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \end{array} \]
          5. Add Preprocessing

          Alternative 6: 71.2% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.9 \cdot 10^{+38} \lor \neg \left(y \leq 1.85 \cdot 10^{-16}\right):\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;x - t \cdot z\\ \end{array} \end{array} \]
          (FPCore (x y z t)
           :precision binary64
           (if (or (<= y -2.9e+38) (not (<= y 1.85e-16))) (* (- t x) y) (- x (* t z))))
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((y <= -2.9e+38) || !(y <= 1.85e-16)) {
          		tmp = (t - x) * y;
          	} else {
          		tmp = x - (t * z);
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x, y, z, t)
          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 ((y <= (-2.9d+38)) .or. (.not. (y <= 1.85d-16))) then
                  tmp = (t - x) * y
              else
                  tmp = x - (t * z)
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((y <= -2.9e+38) || !(y <= 1.85e-16)) {
          		tmp = (t - x) * y;
          	} else {
          		tmp = x - (t * z);
          	}
          	return tmp;
          }
          
          def code(x, y, z, t):
          	tmp = 0
          	if (y <= -2.9e+38) or not (y <= 1.85e-16):
          		tmp = (t - x) * y
          	else:
          		tmp = x - (t * z)
          	return tmp
          
          function code(x, y, z, t)
          	tmp = 0.0
          	if ((y <= -2.9e+38) || !(y <= 1.85e-16))
          		tmp = Float64(Float64(t - x) * y);
          	else
          		tmp = Float64(x - Float64(t * z));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z, t)
          	tmp = 0.0;
          	if ((y <= -2.9e+38) || ~((y <= 1.85e-16)))
          		tmp = (t - x) * y;
          	else
          		tmp = x - (t * z);
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.9e+38], N[Not[LessEqual[y, 1.85e-16]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision], N[(x - N[(t * z), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y \leq -2.9 \cdot 10^{+38} \lor \neg \left(y \leq 1.85 \cdot 10^{-16}\right):\\
          \;\;\;\;\left(t - x\right) \cdot y\\
          
          \mathbf{else}:\\
          \;\;\;\;x - t \cdot z\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < -2.90000000000000007e38 or 1.85e-16 < y

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
            4. 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. lower--.f6479.4

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

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

            if -2.90000000000000007e38 < y < 1.85e-16

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
            4. Step-by-step derivation
              1. associate-*r*N/A

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

                \[\leadsto x + \left(\mathsf{neg}\left(z\right)\right) \cdot \left(\color{blue}{t} - x\right) \]
              3. fp-cancel-sub-signN/A

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

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

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

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

                \[\leadsto x - \left(t - x\right) \cdot z \]
            5. Applied rewrites91.3%

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

              \[\leadsto x - t \cdot z \]
            7. Step-by-step derivation
              1. Applied rewrites68.1%

                \[\leadsto x - t \cdot z \]
            8. Recombined 2 regimes into one program.
            9. Final simplification73.9%

              \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.9 \cdot 10^{+38} \lor \neg \left(y \leq 1.85 \cdot 10^{-16}\right):\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;x - t \cdot z\\ \end{array} \]
            10. Add Preprocessing

            Alternative 7: 67.3% accurate, 0.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.32 \cdot 10^{-18} \lor \neg \left(y \leq 6.5 \cdot 10^{+32}\right):\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\ \end{array} \end{array} \]
            (FPCore (x y z t)
             :precision binary64
             (if (or (<= y -1.32e-18) (not (<= y 6.5e+32))) (* (- t x) y) (fma x z x)))
            double code(double x, double y, double z, double t) {
            	double tmp;
            	if ((y <= -1.32e-18) || !(y <= 6.5e+32)) {
            		tmp = (t - x) * y;
            	} else {
            		tmp = fma(x, z, x);
            	}
            	return tmp;
            }
            
            function code(x, y, z, t)
            	tmp = 0.0
            	if ((y <= -1.32e-18) || !(y <= 6.5e+32))
            		tmp = Float64(Float64(t - x) * y);
            	else
            		tmp = fma(x, z, x);
            	end
            	return tmp
            end
            
            code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.32e-18], N[Not[LessEqual[y, 6.5e+32]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision], N[(x * z + x), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq -1.32 \cdot 10^{-18} \lor \neg \left(y \leq 6.5 \cdot 10^{+32}\right):\\
            \;\;\;\;\left(t - x\right) \cdot y\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -1.3199999999999999e-18 or 6.4999999999999994e32 < y

              1. Initial program 100.0%

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

                \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
              4. 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. lower--.f6478.4

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

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

              if -1.3199999999999999e-18 < y < 6.4999999999999994e32

              1. Initial program 99.9%

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

                \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
              4. Step-by-step derivation
                1. associate-*r*N/A

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

                  \[\leadsto x + \left(\mathsf{neg}\left(z\right)\right) \cdot \left(\color{blue}{t} - x\right) \]
                3. fp-cancel-sub-signN/A

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

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

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

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

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

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

                \[\leadsto x \cdot \color{blue}{\left(1 - -1 \cdot z\right)} \]
              7. Step-by-step derivation
                1. distribute-rgt-out--N/A

                  \[\leadsto 1 \cdot x - \left(-1 \cdot z\right) \cdot \color{blue}{x} \]
                2. *-lft-identityN/A

                  \[\leadsto x - \left(-1 \cdot z\right) \cdot x \]
                3. mul-1-negN/A

                  \[\leadsto x - \left(\mathsf{neg}\left(z\right)\right) \cdot x \]
                4. fp-cancel-sign-subN/A

                  \[\leadsto x + z \cdot \color{blue}{x} \]
                5. *-commutativeN/A

                  \[\leadsto x + x \cdot z \]
                6. +-commutativeN/A

                  \[\leadsto x \cdot z + x \]
                7. lower-fma.f6461.5

                  \[\leadsto \mathsf{fma}\left(x, z, x\right) \]
              8. Applied rewrites61.5%

                \[\leadsto \mathsf{fma}\left(x, \color{blue}{z}, x\right) \]
            3. Recombined 2 regimes into one program.
            4. Final simplification70.2%

              \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.32 \cdot 10^{-18} \lor \neg \left(y \leq 6.5 \cdot 10^{+32}\right):\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\ \end{array} \]
            5. Add Preprocessing

            Alternative 8: 54.2% accurate, 0.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.15 \cdot 10^{+79} \lor \neg \left(z \leq 3 \cdot 10^{+54}\right):\\ \;\;\;\;x \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\ \end{array} \end{array} \]
            (FPCore (x y z t)
             :precision binary64
             (if (or (<= z -2.15e+79) (not (<= z 3e+54))) (* x z) (fma t y x)))
            double code(double x, double y, double z, double t) {
            	double tmp;
            	if ((z <= -2.15e+79) || !(z <= 3e+54)) {
            		tmp = x * z;
            	} else {
            		tmp = fma(t, y, x);
            	}
            	return tmp;
            }
            
            function code(x, y, z, t)
            	tmp = 0.0
            	if ((z <= -2.15e+79) || !(z <= 3e+54))
            		tmp = Float64(x * z);
            	else
            		tmp = fma(t, y, x);
            	end
            	return tmp
            end
            
            code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.15e+79], N[Not[LessEqual[z, 3e+54]], $MachinePrecision]], N[(x * z), $MachinePrecision], N[(t * y + x), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;z \leq -2.15 \cdot 10^{+79} \lor \neg \left(z \leq 3 \cdot 10^{+54}\right):\\
            \;\;\;\;x \cdot z\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z < -2.1500000000000002e79 or 2.9999999999999999e54 < z

              1. Initial program 100.0%

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

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

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

                  \[\leadsto \color{blue}{\left(y - z\right) \cdot \left(t - x\right)} + x \]
                4. lower-fma.f64100.0

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

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

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

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

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

                  \[\leadsto \left(-1 \cdot \left(t - x\right)\right) \cdot \color{blue}{z} \]
                4. mul-1-negN/A

                  \[\leadsto \left(\mathsf{neg}\left(\left(t - x\right)\right)\right) \cdot z \]
                5. *-lft-identityN/A

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

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

                  \[\leadsto \left(\mathsf{neg}\left(\left(t + -1 \cdot x\right)\right)\right) \cdot z \]
                8. +-commutativeN/A

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

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

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

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

                  \[\leadsto \left(x + -1 \cdot t\right) \cdot z \]
                13. metadata-evalN/A

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

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

                  \[\leadsto \left(x - t\right) \cdot z \]
                16. lower--.f6485.0

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

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

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

                  \[\leadsto x \cdot z \]

                if -2.1500000000000002e79 < z < 2.9999999999999999e54

                1. Initial program 99.9%

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

                  \[\leadsto \color{blue}{x + y \cdot \left(t - x\right)} \]
                4. 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. lower--.f6486.1

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

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

                  \[\leadsto \mathsf{fma}\left(t, y, x\right) \]
                7. Step-by-step derivation
                  1. Applied rewrites63.8%

                    \[\leadsto \mathsf{fma}\left(t, y, x\right) \]
                8. Recombined 2 regimes into one program.
                9. Final simplification58.1%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.15 \cdot 10^{+79} \lor \neg \left(z \leq 3 \cdot 10^{+54}\right):\\ \;\;\;\;x \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\ \end{array} \]
                10. Add Preprocessing

                Alternative 9: 50.6% accurate, 0.8× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{+56} \lor \neg \left(y \leq 7.5 \cdot 10^{+35}\right):\\ \;\;\;\;t \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\ \end{array} \end{array} \]
                (FPCore (x y z t)
                 :precision binary64
                 (if (or (<= y -5.5e+56) (not (<= y 7.5e+35))) (* t y) (fma x z x)))
                double code(double x, double y, double z, double t) {
                	double tmp;
                	if ((y <= -5.5e+56) || !(y <= 7.5e+35)) {
                		tmp = t * y;
                	} else {
                		tmp = fma(x, z, x);
                	}
                	return tmp;
                }
                
                function code(x, y, z, t)
                	tmp = 0.0
                	if ((y <= -5.5e+56) || !(y <= 7.5e+35))
                		tmp = Float64(t * y);
                	else
                		tmp = fma(x, z, x);
                	end
                	return tmp
                end
                
                code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.5e+56], N[Not[LessEqual[y, 7.5e+35]], $MachinePrecision]], N[(t * y), $MachinePrecision], N[(x * z + x), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;y \leq -5.5 \cdot 10^{+56} \lor \neg \left(y \leq 7.5 \cdot 10^{+35}\right):\\
                \;\;\;\;t \cdot y\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if y < -5.5000000000000002e56 or 7.4999999999999999e35 < y

                  1. Initial program 100.0%

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

                    \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
                  4. 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. lower--.f6482.3

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

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

                    \[\leadsto t \cdot y \]
                  7. Step-by-step derivation
                    1. Applied rewrites48.0%

                      \[\leadsto t \cdot y \]

                    if -5.5000000000000002e56 < y < 7.4999999999999999e35

                    1. Initial program 100.0%

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

                      \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
                    4. Step-by-step derivation
                      1. associate-*r*N/A

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

                        \[\leadsto x + \left(\mathsf{neg}\left(z\right)\right) \cdot \left(\color{blue}{t} - x\right) \]
                      3. fp-cancel-sub-signN/A

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

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

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

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

                        \[\leadsto x - \left(t - x\right) \cdot z \]
                    5. Applied rewrites87.3%

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

                      \[\leadsto x \cdot \color{blue}{\left(1 - -1 \cdot z\right)} \]
                    7. Step-by-step derivation
                      1. distribute-rgt-out--N/A

                        \[\leadsto 1 \cdot x - \left(-1 \cdot z\right) \cdot \color{blue}{x} \]
                      2. *-lft-identityN/A

                        \[\leadsto x - \left(-1 \cdot z\right) \cdot x \]
                      3. mul-1-negN/A

                        \[\leadsto x - \left(\mathsf{neg}\left(z\right)\right) \cdot x \]
                      4. fp-cancel-sign-subN/A

                        \[\leadsto x + z \cdot \color{blue}{x} \]
                      5. *-commutativeN/A

                        \[\leadsto x + x \cdot z \]
                      6. +-commutativeN/A

                        \[\leadsto x \cdot z + x \]
                      7. lower-fma.f6457.6

                        \[\leadsto \mathsf{fma}\left(x, z, x\right) \]
                    8. Applied rewrites57.6%

                      \[\leadsto \mathsf{fma}\left(x, \color{blue}{z}, x\right) \]
                  8. Recombined 2 regimes into one program.
                  9. Final simplification53.2%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{+56} \lor \neg \left(y \leq 7.5 \cdot 10^{+35}\right):\\ \;\;\;\;t \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\ \end{array} \]
                  10. Add Preprocessing

                  Alternative 10: 38.1% accurate, 0.8× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.35 \cdot 10^{-37} \lor \neg \left(y \leq 5 \cdot 10^{-31}\right):\\ \;\;\;\;t \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                  (FPCore (x y z t)
                   :precision binary64
                   (if (or (<= y -1.35e-37) (not (<= y 5e-31))) (* t y) x))
                  double code(double x, double y, double z, double t) {
                  	double tmp;
                  	if ((y <= -1.35e-37) || !(y <= 5e-31)) {
                  		tmp = t * y;
                  	} else {
                  		tmp = 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 ((y <= (-1.35d-37)) .or. (.not. (y <= 5d-31))) then
                          tmp = t * y
                      else
                          tmp = x
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double y, double z, double t) {
                  	double tmp;
                  	if ((y <= -1.35e-37) || !(y <= 5e-31)) {
                  		tmp = t * y;
                  	} else {
                  		tmp = x;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y, z, t):
                  	tmp = 0
                  	if (y <= -1.35e-37) or not (y <= 5e-31):
                  		tmp = t * y
                  	else:
                  		tmp = x
                  	return tmp
                  
                  function code(x, y, z, t)
                  	tmp = 0.0
                  	if ((y <= -1.35e-37) || !(y <= 5e-31))
                  		tmp = Float64(t * y);
                  	else
                  		tmp = x;
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y, z, t)
                  	tmp = 0.0;
                  	if ((y <= -1.35e-37) || ~((y <= 5e-31)))
                  		tmp = t * y;
                  	else
                  		tmp = x;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.35e-37], N[Not[LessEqual[y, 5e-31]], $MachinePrecision]], N[(t * y), $MachinePrecision], x]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;y \leq -1.35 \cdot 10^{-37} \lor \neg \left(y \leq 5 \cdot 10^{-31}\right):\\
                  \;\;\;\;t \cdot y\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;x\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if y < -1.35000000000000008e-37 or 5e-31 < y

                    1. Initial program 100.0%

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

                      \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
                    4. 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. lower--.f6474.5

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

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

                      \[\leadsto t \cdot y \]
                    7. Step-by-step derivation
                      1. Applied rewrites43.5%

                        \[\leadsto t \cdot y \]

                      if -1.35000000000000008e-37 < y < 5e-31

                      1. Initial program 100.0%

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

                        \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
                      4. Step-by-step derivation
                        1. associate-*r*N/A

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

                          \[\leadsto x + \left(\mathsf{neg}\left(z\right)\right) \cdot \left(\color{blue}{t} - x\right) \]
                        3. fp-cancel-sub-signN/A

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

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

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

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

                          \[\leadsto x - \left(t - x\right) \cdot z \]
                      5. Applied rewrites94.8%

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

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

                          \[\leadsto x \]
                      8. Recombined 2 regimes into one program.
                      9. Final simplification41.5%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.35 \cdot 10^{-37} \lor \neg \left(y \leq 5 \cdot 10^{-31}\right):\\ \;\;\;\;t \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
                      10. Add Preprocessing

                      Alternative 11: 17.5% accurate, 15.0× speedup?

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

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

                        \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
                      4. Step-by-step derivation
                        1. associate-*r*N/A

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

                          \[\leadsto x + \left(\mathsf{neg}\left(z\right)\right) \cdot \left(\color{blue}{t} - x\right) \]
                        3. fp-cancel-sub-signN/A

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

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

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

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

                          \[\leadsto x - \left(t - x\right) \cdot z \]
                      5. Applied rewrites59.9%

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

                        \[\leadsto x \]
                      7. Step-by-step derivation
                        1. Applied rewrites19.1%

                          \[\leadsto x \]
                        2. Final simplification19.1%

                          \[\leadsto x \]
                        3. Add Preprocessing

                        Developer Target 1: 96.8% accurate, 0.6× speedup?

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

                        Reproduce

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