Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 3.4s
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. lift--.f64N/A

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

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

      \[\leadsto x + \color{blue}{\left(y - z\right) \cdot \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) \]
  4. Applied rewrites100.0%

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

Alternative 2: 53.6% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -6.8 \cdot 10^{+220}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -2.15 \cdot 10^{+57}:\\ \;\;\;\;\left(-z\right) \cdot t\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-14}:\\ \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\ \mathbf{elif}\;z \leq 4.9 \cdot 10^{+101}:\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -6.8e+220)
   (* z x)
   (if (<= z -2.15e+57)
     (* (- z) t)
     (if (<= z 2.8e-14)
       (fma t y x)
       (if (<= z 4.9e+101) (* (- x) y) (* z x))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -6.8e+220) {
		tmp = z * x;
	} else if (z <= -2.15e+57) {
		tmp = -z * t;
	} else if (z <= 2.8e-14) {
		tmp = fma(t, y, x);
	} else if (z <= 4.9e+101) {
		tmp = -x * y;
	} else {
		tmp = z * x;
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -6.8e+220)
		tmp = Float64(z * x);
	elseif (z <= -2.15e+57)
		tmp = Float64(Float64(-z) * t);
	elseif (z <= 2.8e-14)
		tmp = fma(t, y, x);
	elseif (z <= 4.9e+101)
		tmp = Float64(Float64(-x) * y);
	else
		tmp = Float64(z * x);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.8e+220], N[(z * x), $MachinePrecision], If[LessEqual[z, -2.15e+57], N[((-z) * t), $MachinePrecision], If[LessEqual[z, 2.8e-14], N[(t * y + x), $MachinePrecision], If[LessEqual[z, 4.9e+101], N[((-x) * y), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{+220}:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;z \leq -2.15 \cdot 10^{+57}:\\
\;\;\;\;\left(-z\right) \cdot t\\

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

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

\mathbf{else}:\\
\;\;\;\;z \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -6.8000000000000001e220 or 4.89999999999999983e101 < z

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto z \cdot x \]

      if -6.8000000000000001e220 < z < -2.15000000000000016e57

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(y - z\right) \cdot t \]
      7. Applied rewrites60.9%

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

        \[\leadsto \left(-1 \cdot z\right) \cdot t \]
      9. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \left(\mathsf{neg}\left(z\right)\right) \cdot t \]
        2. lower-neg.f6447.4

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

        \[\leadsto \left(-z\right) \cdot t \]

      if -2.15000000000000016e57 < z < 2.8000000000000001e-14

      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. lift--.f6486.6

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

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

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

        if 2.8000000000000001e-14 < z < 4.89999999999999983e101

        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. lift--.f6465.6

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

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

          \[\leadsto \left(-1 \cdot x\right) \cdot y \]
        7. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \left(\mathsf{neg}\left(x\right)\right) \cdot y \]
          2. lift-neg.f6443.2

            \[\leadsto \left(-x\right) \cdot y \]
        8. Applied rewrites43.2%

          \[\leadsto \left(-x\right) \cdot y \]
      8. Recombined 4 regimes into one program.
      9. Final simplification58.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.8 \cdot 10^{+220}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -2.15 \cdot 10^{+57}:\\ \;\;\;\;\left(-z\right) \cdot t\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-14}:\\ \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\ \mathbf{elif}\;z \leq 4.9 \cdot 10^{+101}:\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
      10. Add Preprocessing

      Alternative 3: 53.2% accurate, 0.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.9 \cdot 10^{+73}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-14}:\\ \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\ \mathbf{elif}\;z \leq 4.9 \cdot 10^{+101}:\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (if (<= z -2.9e+73)
         (* z x)
         (if (<= z 2.8e-14) (fma t y x) (if (<= z 4.9e+101) (* (- x) y) (* z x)))))
      double code(double x, double y, double z, double t) {
      	double tmp;
      	if (z <= -2.9e+73) {
      		tmp = z * x;
      	} else if (z <= 2.8e-14) {
      		tmp = fma(t, y, x);
      	} else if (z <= 4.9e+101) {
      		tmp = -x * y;
      	} else {
      		tmp = z * x;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	tmp = 0.0
      	if (z <= -2.9e+73)
      		tmp = Float64(z * x);
      	elseif (z <= 2.8e-14)
      		tmp = fma(t, y, x);
      	elseif (z <= 4.9e+101)
      		tmp = Float64(Float64(-x) * y);
      	else
      		tmp = Float64(z * x);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := If[LessEqual[z, -2.9e+73], N[(z * x), $MachinePrecision], If[LessEqual[z, 2.8e-14], N[(t * y + x), $MachinePrecision], If[LessEqual[z, 4.9e+101], N[((-x) * y), $MachinePrecision], N[(z * x), $MachinePrecision]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;z \leq -2.9 \cdot 10^{+73}:\\
      \;\;\;\;z \cdot x\\
      
      \mathbf{elif}\;z \leq 2.8 \cdot 10^{-14}:\\
      \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
      
      \mathbf{elif}\;z \leq 4.9 \cdot 10^{+101}:\\
      \;\;\;\;\left(-x\right) \cdot y\\
      
      \mathbf{else}:\\
      \;\;\;\;z \cdot x\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if z < -2.9000000000000002e73 or 4.89999999999999983e101 < z

        1. Initial program 100.0%

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

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

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

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

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

            \[\leadsto z \cdot x \]

          if -2.9000000000000002e73 < z < 2.8000000000000001e-14

          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. lift--.f6485.6

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

            \[\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) \]

            if 2.8000000000000001e-14 < z < 4.89999999999999983e101

            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. lift--.f6465.6

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

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

              \[\leadsto \left(-1 \cdot x\right) \cdot y \]
            7. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto \left(\mathsf{neg}\left(x\right)\right) \cdot y \]
              2. lift-neg.f6443.2

                \[\leadsto \left(-x\right) \cdot y \]
            8. Applied rewrites43.2%

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

          Alternative 4: 38.2% accurate, 0.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.9 \cdot 10^{+73}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{-297}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-11}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
          (FPCore (x y z t)
           :precision binary64
           (if (<= z -2.9e+73)
             (* z x)
             (if (<= z -1.1e-297) (* t y) (if (<= z 1.6e-11) x (* z x)))))
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if (z <= -2.9e+73) {
          		tmp = z * x;
          	} else if (z <= -1.1e-297) {
          		tmp = t * y;
          	} else if (z <= 1.6e-11) {
          		tmp = 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 <= (-2.9d+73)) then
                  tmp = z * x
              else if (z <= (-1.1d-297)) then
                  tmp = t * y
              else if (z <= 1.6d-11) then
                  tmp = 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 <= -2.9e+73) {
          		tmp = z * x;
          	} else if (z <= -1.1e-297) {
          		tmp = t * y;
          	} else if (z <= 1.6e-11) {
          		tmp = x;
          	} else {
          		tmp = z * x;
          	}
          	return tmp;
          }
          
          def code(x, y, z, t):
          	tmp = 0
          	if z <= -2.9e+73:
          		tmp = z * x
          	elif z <= -1.1e-297:
          		tmp = t * y
          	elif z <= 1.6e-11:
          		tmp = x
          	else:
          		tmp = z * x
          	return tmp
          
          function code(x, y, z, t)
          	tmp = 0.0
          	if (z <= -2.9e+73)
          		tmp = Float64(z * x);
          	elseif (z <= -1.1e-297)
          		tmp = Float64(t * y);
          	elseif (z <= 1.6e-11)
          		tmp = x;
          	else
          		tmp = Float64(z * x);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z, t)
          	tmp = 0.0;
          	if (z <= -2.9e+73)
          		tmp = z * x;
          	elseif (z <= -1.1e-297)
          		tmp = t * y;
          	elseif (z <= 1.6e-11)
          		tmp = x;
          	else
          		tmp = z * x;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_, t_] := If[LessEqual[z, -2.9e+73], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.1e-297], N[(t * y), $MachinePrecision], If[LessEqual[z, 1.6e-11], x, N[(z * x), $MachinePrecision]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;z \leq -2.9 \cdot 10^{+73}:\\
          \;\;\;\;z \cdot x\\
          
          \mathbf{elif}\;z \leq -1.1 \cdot 10^{-297}:\\
          \;\;\;\;t \cdot y\\
          
          \mathbf{elif}\;z \leq 1.6 \cdot 10^{-11}:\\
          \;\;\;\;x\\
          
          \mathbf{else}:\\
          \;\;\;\;z \cdot x\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if z < -2.9000000000000002e73 or 1.59999999999999997e-11 < z

            1. Initial program 100.0%

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

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

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

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

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

                \[\leadsto z \cdot x \]

              if -2.9000000000000002e73 < z < -1.0999999999999999e-297

              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. lift--.f6460.2

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

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

                  \[\leadsto t \cdot y \]

                if -1.0999999999999999e-297 < z < 1.59999999999999997e-11

                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. lift--.f6491.7

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

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

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

                    \[\leadsto x \]
                8. Recombined 3 regimes into one program.
                9. Add Preprocessing

                Alternative 5: 83.1% accurate, 0.7× speedup?

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

                  1. Initial program 100.0%

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

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

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

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

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

                      \[\leadsto \left(-z\right) \cdot \left(\color{blue}{t} - x\right) \]
                    5. lift--.f6481.9

                      \[\leadsto \left(-z\right) \cdot \left(t - \color{blue}{x}\right) \]
                  5. Applied rewrites81.9%

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

                  if -480 < z < 4.89999999999999983e101

                  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. lift--.f6487.2

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

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

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

                Alternative 6: 69.5% accurate, 0.7× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{-6}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;z \leq 1.86 \cdot 10^{+102}:\\ \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
                (FPCore (x y z t)
                 :precision binary64
                 (if (<= z -1.45e-6)
                   (* (- y z) t)
                   (if (<= z 1.86e+102) (fma (- t x) y x) (* z x))))
                double code(double x, double y, double z, double t) {
                	double tmp;
                	if (z <= -1.45e-6) {
                		tmp = (y - z) * t;
                	} else if (z <= 1.86e+102) {
                		tmp = fma((t - x), y, x);
                	} else {
                		tmp = z * x;
                	}
                	return tmp;
                }
                
                function code(x, y, z, t)
                	tmp = 0.0
                	if (z <= -1.45e-6)
                		tmp = Float64(Float64(y - z) * t);
                	elseif (z <= 1.86e+102)
                		tmp = fma(Float64(t - x), y, x);
                	else
                		tmp = Float64(z * x);
                	end
                	return tmp
                end
                
                code[x_, y_, z_, t_] := If[LessEqual[z, -1.45e-6], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[z, 1.86e+102], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], N[(z * x), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;z \leq -1.45 \cdot 10^{-6}:\\
                \;\;\;\;\left(y - z\right) \cdot t\\
                
                \mathbf{elif}\;z \leq 1.86 \cdot 10^{+102}:\\
                \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;z \cdot x\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if z < -1.4500000000000001e-6

                  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. lift--.f6455.4

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

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

                  if -1.4500000000000001e-6 < z < 1.8600000000000001e102

                  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. lift--.f6487.7

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

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

                  if 1.8600000000000001e102 < z

                  1. Initial program 100.0%

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

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

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

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

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

                      \[\leadsto z \cdot x \]
                  8. Recombined 3 regimes into one program.
                  9. Add Preprocessing

                  Alternative 7: 66.9% accurate, 0.7× speedup?

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

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

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

                    if -2.85000000000000009e53 < y < 8.60000000000000029e-10

                    1. Initial program 100.0%

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

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

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

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

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

                        \[\leadsto \left(1 + z\right) \cdot x \]
                    8. Applied rewrites59.2%

                      \[\leadsto \left(1 + z\right) \cdot x \]
                  3. Recombined 2 regimes into one program.
                  4. Final simplification71.0%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.85 \cdot 10^{+53} \lor \neg \left(y \leq 8.6 \cdot 10^{-10}\right):\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(1 + z\right) \cdot x\\ \end{array} \]
                  5. Add Preprocessing

                  Alternative 8: 50.8% accurate, 0.7× speedup?

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

                    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. lift--.f6464.9

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

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

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

                      if -4.80000000000000004e-50 < t < 4.3999999999999997e35

                      1. Initial program 100.0%

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

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

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

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

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

                          \[\leadsto \left(1 + z\right) \cdot x \]
                      8. Applied rewrites57.3%

                        \[\leadsto \left(1 + z\right) \cdot x \]
                    8. Recombined 2 regimes into one program.
                    9. Final simplification56.0%

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

                    Alternative 9: 53.9% accurate, 0.8× speedup?

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

                      1. Initial program 100.0%

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

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

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

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

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

                          \[\leadsto z \cdot x \]

                        if -2.9000000000000002e73 < z < 1.55000000000000007e57

                        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. lift--.f6482.9

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

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

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

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

                        Alternative 10: 37.2% accurate, 0.8× speedup?

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

                          1. Initial program 100.0%

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

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

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

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

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

                              \[\leadsto z \cdot x \]

                            if -5.1000000000000003e-6 < z < 1.59999999999999997e-11

                            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. lift--.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)} \]
                            6. Taylor expanded in y around 0

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

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

                              \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.1 \cdot 10^{-6} \lor \neg \left(z \leq 1.6 \cdot 10^{-11}\right):\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
                            10. Add Preprocessing

                            Alternative 11: 17.4% 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 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. lift--.f6463.0

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

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

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

                                \[\leadsto x \]
                              2. Add Preprocessing

                              Developer Target 1: 96.7% 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 2025060 
                              (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))))