Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 3.7s
Alternatives: 13
Speedup: 1.0×

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 13 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.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}
Derivation
  1. Initial program 100.0%

    \[x + \left(y - z\right) \cdot \left(t - x\right) \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 63.0% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
t_2 := \left(t - x\right) \cdot y\\
\mathbf{if}\;y \leq -0.0022:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;y \leq 9.8 \cdot 10^{-141}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 0.0054:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\

\mathbf{elif}\;y \leq 6.8 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -0.00220000000000000013 or 6.8000000000000003e67 < 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--.f6481.6

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

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

    if -0.00220000000000000013 < y < -1.7500000000000001e-137 or 9.80000000000000012e-141 < y < 0.0054000000000000003

    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--.f6468.1

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

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

        \[\leadsto z \cdot x \]
      2. Taylor expanded in y around 0

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

          \[\leadsto \left(1 + z\right) \cdot x \]
        2. +-commutativeN/A

          \[\leadsto \left(z + 1\right) \cdot x \]
        3. distribute-lft1-inN/A

          \[\leadsto z \cdot x + x \]
        4. lower-fma.f6464.4

          \[\leadsto \mathsf{fma}\left(z, x, x\right) \]
      4. Applied rewrites64.4%

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

      if -1.7500000000000001e-137 < y < 9.80000000000000012e-141 or 0.0054000000000000003 < y < 6.8000000000000003e67

      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--.f6466.1

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.0022:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{elif}\;y \leq -1.75 \cdot 10^{-137}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-141}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 0.0054:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{+67}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(t - x\right) \cdot y\\ \end{array} \]
    10. Add Preprocessing

    Alternative 3: 38.3% accurate, 0.5× speedup?

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

      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 z around inf

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

          \[\leadsto z \cdot x \]

        if -2.00000000000000015e191 < (-.f64 y z) < -9.99999999999999955e-7 or 5.00000000000000041e-6 < (-.f64 y z)

        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--.f6454.9

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

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

            \[\leadsto t \cdot y \]

          if -9.99999999999999955e-7 < (-.f64 y z) < 5.00000000000000041e-6

          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--.f6478.5

              \[\leadsto \mathsf{fma}\left(t - x, y, x\right) \]
          5. Applied rewrites78.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 rewrites67.6%

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

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

          Alternative 4: 82.7% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -8500 \lor \neg \left(z \leq 2.5 \cdot 10^{+108}\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 -8500.0) (not (<= z 2.5e+108)))
             (* (- z) (- t x))
             (fma (- t x) y x)))
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((z <= -8500.0) || !(z <= 2.5e+108)) {
          		tmp = -z * (t - x);
          	} else {
          		tmp = fma((t - x), y, x);
          	}
          	return tmp;
          }
          
          function code(x, y, z, t)
          	tmp = 0.0
          	if ((z <= -8500.0) || !(z <= 2.5e+108))
          		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, -8500.0], N[Not[LessEqual[z, 2.5e+108]], $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 -8500 \lor \neg \left(z \leq 2.5 \cdot 10^{+108}\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 < -8500 or 2.49999999999999995e108 < 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--.f6486.8

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

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

            if -8500 < z < 2.49999999999999995e108

            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--.f6488.0

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8500 \lor \neg \left(z \leq 2.5 \cdot 10^{+108}\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 5: 82.8% accurate, 0.7× speedup?

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

            1. Initial program 99.9%

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(-z, t - \color{blue}{x}, x\right) \]
            5. Applied rewrites81.6%

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

            if -6200 < z < 2.49999999999999995e108

            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--.f6488.0

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

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

            if 2.49999999999999995e108 < 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--.f6495.6

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

              \[\leadsto \color{blue}{\left(-z\right) \cdot \left(t - x\right)} \]
          3. Recombined 3 regimes into one program.
          4. Final simplification87.7%

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

          Alternative 6: 71.8% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1350 \lor \neg \left(z \leq 5.8 \cdot 10^{+74}\right):\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\ \end{array} \end{array} \]
          (FPCore (x y z t)
           :precision binary64
           (if (or (<= z -1350.0) (not (<= z 5.8e+74))) (* (- y z) t) (fma (- t x) y x)))
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((z <= -1350.0) || !(z <= 5.8e+74)) {
          		tmp = (y - z) * t;
          	} else {
          		tmp = fma((t - x), y, x);
          	}
          	return tmp;
          }
          
          function code(x, y, z, t)
          	tmp = 0.0
          	if ((z <= -1350.0) || !(z <= 5.8e+74))
          		tmp = Float64(Float64(y - z) * t);
          	else
          		tmp = fma(Float64(t - x), y, x);
          	end
          	return tmp
          end
          
          code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1350.0], N[Not[LessEqual[z, 5.8e+74]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;z \leq -1350 \lor \neg \left(z \leq 5.8 \cdot 10^{+74}\right):\\
          \;\;\;\;\left(y - z\right) \cdot t\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z < -1350 or 5.8000000000000005e74 < 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 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--.f6462.1

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

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

            if -1350 < z < 5.8000000000000005e74

            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--.f6489.5

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

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

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

          Alternative 7: 62.4% accurate, 0.7× speedup?

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

            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--.f6469.1

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

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

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

                \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(x\right), y, x\right) \]
              2. lift-neg.f6462.6

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

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

            if -5.40000000000000039e53 < x < 8.5000000000000001e87

            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--.f6473.9

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

              \[\leadsto \color{blue}{\left(y - z\right) \cdot t} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification69.3%

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

          Alternative 8: 68.7% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.0022 \lor \neg \left(y \leq 0.01\right):\\ \;\;\;\;\left(t - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \end{array} \end{array} \]
          (FPCore (x y z t)
           :precision binary64
           (if (or (<= y -0.0022) (not (<= y 0.01))) (* (- t x) y) (fma z x x)))
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((y <= -0.0022) || !(y <= 0.01)) {
          		tmp = (t - x) * y;
          	} else {
          		tmp = fma(z, x, x);
          	}
          	return tmp;
          }
          
          function code(x, y, z, t)
          	tmp = 0.0
          	if ((y <= -0.0022) || !(y <= 0.01))
          		tmp = Float64(Float64(t - x) * y);
          	else
          		tmp = fma(z, x, x);
          	end
          	return tmp
          end
          
          code[x_, y_, z_, t_] := If[Or[LessEqual[y, -0.0022], N[Not[LessEqual[y, 0.01]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision], N[(z * x + x), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y \leq -0.0022 \lor \neg \left(y \leq 0.01\right):\\
          \;\;\;\;\left(t - x\right) \cdot y\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < -0.00220000000000000013 or 0.0100000000000000002 < 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--.f6477.9

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

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

            if -0.00220000000000000013 < y < 0.0100000000000000002

            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.8

                \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
            5. Applied rewrites55.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 rewrites24.1%

                \[\leadsto z \cdot x \]
              2. Taylor expanded in y around 0

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

                  \[\leadsto \left(1 + z\right) \cdot x \]
                2. +-commutativeN/A

                  \[\leadsto \left(z + 1\right) \cdot x \]
                3. distribute-lft1-inN/A

                  \[\leadsto z \cdot x + x \]
                4. lower-fma.f6454.1

                  \[\leadsto \mathsf{fma}\left(z, x, x\right) \]
              4. Applied rewrites54.1%

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

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

            Alternative 9: 54.1% accurate, 0.7× speedup?

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

              1. Initial program 100.0%

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

                  \[\leadsto \color{blue}{x + \left(y - z\right) \cdot \left(t - x\right)} \]
                2. 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
              6. Step-by-step derivation
                1. 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. lift-neg.f64N/A

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

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

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

                \[\leadsto \left(-z\right) \cdot t \]
              9. Step-by-step derivation
                1. Applied rewrites53.5%

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

                if -1020 < z < 6.49999999999999962e74

                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--.f6489.5

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

                  \[\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) \]
                8. Recombined 2 regimes into one program.
                9. Final simplification59.5%

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

                Alternative 10: 53.8% accurate, 0.8× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{-6} \lor \neg \left(z \leq 1.05 \cdot 10^{+115}\right):\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\ \end{array} \end{array} \]
                (FPCore (x y z t)
                 :precision binary64
                 (if (or (<= z -3.6e-6) (not (<= z 1.05e+115))) (fma z x x) (fma t y x)))
                double code(double x, double y, double z, double t) {
                	double tmp;
                	if ((z <= -3.6e-6) || !(z <= 1.05e+115)) {
                		tmp = fma(z, x, x);
                	} else {
                		tmp = fma(t, y, x);
                	}
                	return tmp;
                }
                
                function code(x, y, z, t)
                	tmp = 0.0
                	if ((z <= -3.6e-6) || !(z <= 1.05e+115))
                		tmp = fma(z, x, x);
                	else
                		tmp = fma(t, y, x);
                	end
                	return tmp
                end
                
                code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.6e-6], N[Not[LessEqual[z, 1.05e+115]], $MachinePrecision]], N[(z * x + x), $MachinePrecision], N[(t * y + x), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;z \leq -3.6 \cdot 10^{-6} \lor \neg \left(z \leq 1.05 \cdot 10^{+115}\right):\\
                \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if z < -3.59999999999999984e-6 or 1.05000000000000002e115 < 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--.f6448.8

                      \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                  5. Applied rewrites48.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 rewrites40.9%

                      \[\leadsto z \cdot x \]
                    2. Taylor expanded in y around 0

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

                        \[\leadsto \left(1 + z\right) \cdot x \]
                      2. +-commutativeN/A

                        \[\leadsto \left(z + 1\right) \cdot x \]
                      3. distribute-lft1-inN/A

                        \[\leadsto z \cdot x + x \]
                      4. lower-fma.f6442.4

                        \[\leadsto \mathsf{fma}\left(z, x, x\right) \]
                    4. Applied rewrites42.4%

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

                    if -3.59999999999999984e-6 < z < 1.05000000000000002e115

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

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

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

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

                    Alternative 11: 50.9% accurate, 0.8× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.0022 \lor \neg \left(y \leq 0.01\right):\\ \;\;\;\;t \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \end{array} \end{array} \]
                    (FPCore (x y z t)
                     :precision binary64
                     (if (or (<= y -0.0022) (not (<= y 0.01))) (* t y) (fma z x x)))
                    double code(double x, double y, double z, double t) {
                    	double tmp;
                    	if ((y <= -0.0022) || !(y <= 0.01)) {
                    		tmp = t * y;
                    	} else {
                    		tmp = fma(z, x, x);
                    	}
                    	return tmp;
                    }
                    
                    function code(x, y, z, t)
                    	tmp = 0.0
                    	if ((y <= -0.0022) || !(y <= 0.01))
                    		tmp = Float64(t * y);
                    	else
                    		tmp = fma(z, x, x);
                    	end
                    	return tmp
                    end
                    
                    code[x_, y_, z_, t_] := If[Or[LessEqual[y, -0.0022], N[Not[LessEqual[y, 0.01]], $MachinePrecision]], N[(t * y), $MachinePrecision], N[(z * x + x), $MachinePrecision]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;y \leq -0.0022 \lor \neg \left(y \leq 0.01\right):\\
                    \;\;\;\;t \cdot y\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if y < -0.00220000000000000013 or 0.0100000000000000002 < 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--.f6477.9

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

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

                          \[\leadsto t \cdot y \]

                        if -0.00220000000000000013 < y < 0.0100000000000000002

                        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.8

                            \[\leadsto \left(1 - \left(y - z\right)\right) \cdot x \]
                        5. Applied rewrites55.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 rewrites24.1%

                            \[\leadsto z \cdot x \]
                          2. Taylor expanded in y around 0

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

                              \[\leadsto \left(1 + z\right) \cdot x \]
                            2. +-commutativeN/A

                              \[\leadsto \left(z + 1\right) \cdot x \]
                            3. distribute-lft1-inN/A

                              \[\leadsto z \cdot x + x \]
                            4. lower-fma.f6454.1

                              \[\leadsto \mathsf{fma}\left(z, x, x\right) \]
                          4. Applied rewrites54.1%

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

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

                        Alternative 12: 37.6% accurate, 0.8× speedup?

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

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

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

                              \[\leadsto z \cdot x \]

                            if -125 < z < 0.0015

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

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

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

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

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

                            Alternative 13: 18.3% 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--.f6460.3

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

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

                                \[\leadsto x \]
                              2. Final simplification15.5%

                                \[\leadsto x \]
                              3. Add Preprocessing

                              Developer Target 1: 96.2% 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 2025057 
                              (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))))