Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 2.7s
Alternatives: 13
Speedup: 1.2×

Specification

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

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

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

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

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.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 36.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y - z \leq -4 \cdot 10^{+164}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;y - z \leq -2 \cdot 10^{+34}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;y - z \leq 5 \cdot 10^{-40}:\\ \;\;\;\;x\\ \mathbf{elif}\;y - z \leq 4 \cdot 10^{+101}:\\ \;\;\;\;t \cdot y\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (- y z) -4e+164)
   (* t y)
   (if (<= (- y z) -2e+34)
     (* z x)
     (if (<= (- y z) 5e-40) x (if (<= (- y z) 4e+101) (* t y) (* z x))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y - z) <= -4e+164) {
		tmp = t * y;
	} else if ((y - z) <= -2e+34) {
		tmp = z * x;
	} else if ((y - z) <= 5e-40) {
		tmp = x;
	} else if ((y - z) <= 4e+101) {
		tmp = t * y;
	} else {
		tmp = z * x;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((y - z) <= (-4d+164)) then
        tmp = t * y
    else if ((y - z) <= (-2d+34)) then
        tmp = z * x
    else if ((y - z) <= 5d-40) then
        tmp = x
    else if ((y - z) <= 4d+101) then
        tmp = t * y
    else
        tmp = z * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y - z) <= -4e+164) {
		tmp = t * y;
	} else if ((y - z) <= -2e+34) {
		tmp = z * x;
	} else if ((y - z) <= 5e-40) {
		tmp = x;
	} else if ((y - z) <= 4e+101) {
		tmp = t * y;
	} else {
		tmp = z * x;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y - z) <= -4e+164:
		tmp = t * y
	elif (y - z) <= -2e+34:
		tmp = z * x
	elif (y - z) <= 5e-40:
		tmp = x
	elif (y - z) <= 4e+101:
		tmp = t * y
	else:
		tmp = z * x
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(y - z) <= -4e+164)
		tmp = Float64(t * y);
	elseif (Float64(y - z) <= -2e+34)
		tmp = Float64(z * x);
	elseif (Float64(y - z) <= 5e-40)
		tmp = x;
	elseif (Float64(y - z) <= 4e+101)
		tmp = Float64(t * y);
	else
		tmp = Float64(z * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y - z) <= -4e+164)
		tmp = t * y;
	elseif ((y - z) <= -2e+34)
		tmp = z * x;
	elseif ((y - z) <= 5e-40)
		tmp = x;
	elseif ((y - z) <= 4e+101)
		tmp = t * y;
	else
		tmp = z * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(y - z), $MachinePrecision], -4e+164], N[(t * y), $MachinePrecision], If[LessEqual[N[(y - z), $MachinePrecision], -2e+34], N[(z * x), $MachinePrecision], If[LessEqual[N[(y - z), $MachinePrecision], 5e-40], x, If[LessEqual[N[(y - z), $MachinePrecision], 4e+101], N[(t * y), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -4 \cdot 10^{+164}:\\
\;\;\;\;t \cdot y\\

\mathbf{elif}\;y - z \leq -2 \cdot 10^{+34}:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;y - z \leq 5 \cdot 10^{-40}:\\
\;\;\;\;x\\

\mathbf{elif}\;y - z \leq 4 \cdot 10^{+101}:\\
\;\;\;\;t \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 y z) < -4e164 or 4.99999999999999965e-40 < (-.f64 y z) < 3.9999999999999999e101

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

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

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

        \[\leadsto t \cdot y \]

      if -4e164 < (-.f64 y z) < -1.99999999999999989e34 or 3.9999999999999999e101 < (-.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 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--.f6452.8

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

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

        \[\leadsto x + \color{blue}{x \cdot z} \]
      7. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto x \cdot z + x \]
        2. lower-fma.f6428.8

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

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

        \[\leadsto x \cdot z \]
      10. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto z \cdot x \]
        2. lower-*.f6428.7

          \[\leadsto z \cdot x \]
      11. Applied rewrites28.7%

        \[\leadsto z \cdot x \]

      if -1.99999999999999989e34 < (-.f64 y z) < 4.99999999999999965e-40

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

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

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

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

      Alternative 3: 69.8% accurate, 0.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y - z\right) \cdot t\\ \mathbf{if}\;z \leq -3.3 \cdot 10^{+146}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{+105}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -0.0132:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.32 \cdot 10^{+119}:\\ \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (let* ((t_1 (* (- y z) t)))
         (if (<= z -3.3e+146)
           t_1
           (if (<= z -5.5e+105)
             (* z x)
             (if (<= z -0.0132)
               t_1
               (if (<= z 1.32e+119) (fma (- t x) y x) (* z x)))))))
      double code(double x, double y, double z, double t) {
      	double t_1 = (y - z) * t;
      	double tmp;
      	if (z <= -3.3e+146) {
      		tmp = t_1;
      	} else if (z <= -5.5e+105) {
      		tmp = z * x;
      	} else if (z <= -0.0132) {
      		tmp = t_1;
      	} else if (z <= 1.32e+119) {
      		tmp = fma((t - x), y, x);
      	} else {
      		tmp = z * x;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	t_1 = Float64(Float64(y - z) * t)
      	tmp = 0.0
      	if (z <= -3.3e+146)
      		tmp = t_1;
      	elseif (z <= -5.5e+105)
      		tmp = Float64(z * x);
      	elseif (z <= -0.0132)
      		tmp = t_1;
      	elseif (z <= 1.32e+119)
      		tmp = fma(Float64(t - x), y, x);
      	else
      		tmp = Float64(z * x);
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -3.3e+146], t$95$1, If[LessEqual[z, -5.5e+105], N[(z * x), $MachinePrecision], If[LessEqual[z, -0.0132], t$95$1, If[LessEqual[z, 1.32e+119], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \left(y - z\right) \cdot t\\
      \mathbf{if}\;z \leq -3.3 \cdot 10^{+146}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;z \leq -5.5 \cdot 10^{+105}:\\
      \;\;\;\;z \cdot x\\
      
      \mathbf{elif}\;z \leq -0.0132:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;z \leq 1.32 \cdot 10^{+119}:\\
      \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;z \cdot x\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if z < -3.30000000000000016e146 or -5.49999999999999979e105 < z < -0.0132

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

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

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

        if -3.30000000000000016e146 < z < -5.49999999999999979e105 or 1.32e119 < 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 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--.f6485.8

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

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

          \[\leadsto x + \color{blue}{x \cdot z} \]
        7. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto x \cdot z + x \]
          2. lower-fma.f6446.0

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

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

          \[\leadsto x \cdot z \]
        10. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto z \cdot x \]
          2. lower-*.f6446.0

            \[\leadsto z \cdot x \]
        11. Applied rewrites46.0%

          \[\leadsto z \cdot x \]

        if -0.0132 < z < 1.32e119

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

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

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

      Alternative 4: 67.6% accurate, 0.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - x\right) \cdot y\\ t_2 := \left(y - z\right) \cdot t\\ \mathbf{if}\;y \leq -3 \cdot 10^{+88}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-15}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 1.08 \cdot 10^{-89}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\ \mathbf{elif}\;y \leq 0.000116:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (x y z t)
       :precision binary64
       (let* ((t_1 (* (- t x) y)) (t_2 (* (- y z) t)))
         (if (<= y -3e+88)
           t_1
           (if (<= y -5.2e-15)
             t_2
             (if (<= y 1.08e-89) (fma x z x) (if (<= y 0.000116) t_2 t_1))))))
      double code(double x, double y, double z, double t) {
      	double t_1 = (t - x) * y;
      	double t_2 = (y - z) * t;
      	double tmp;
      	if (y <= -3e+88) {
      		tmp = t_1;
      	} else if (y <= -5.2e-15) {
      		tmp = t_2;
      	} else if (y <= 1.08e-89) {
      		tmp = fma(x, z, x);
      	} else if (y <= 0.000116) {
      		tmp = t_2;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	t_1 = Float64(Float64(t - x) * y)
      	t_2 = Float64(Float64(y - z) * t)
      	tmp = 0.0
      	if (y <= -3e+88)
      		tmp = t_1;
      	elseif (y <= -5.2e-15)
      		tmp = t_2;
      	elseif (y <= 1.08e-89)
      		tmp = fma(x, z, x);
      	elseif (y <= 0.000116)
      		tmp = t_2;
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[y, -3e+88], t$95$1, If[LessEqual[y, -5.2e-15], t$95$2, If[LessEqual[y, 1.08e-89], N[(x * z + x), $MachinePrecision], If[LessEqual[y, 0.000116], t$95$2, t$95$1]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \left(t - x\right) \cdot y\\
      t_2 := \left(y - z\right) \cdot t\\
      \mathbf{if}\;y \leq -3 \cdot 10^{+88}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;y \leq -5.2 \cdot 10^{-15}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;y \leq 1.08 \cdot 10^{-89}:\\
      \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
      
      \mathbf{elif}\;y \leq 0.000116:\\
      \;\;\;\;t\_2\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y < -3.00000000000000005e88 or 1.16e-4 < 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--.f6480.9

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

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

        if -3.00000000000000005e88 < y < -5.20000000000000009e-15 or 1.07999999999999999e-89 < y < 1.16e-4

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

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

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

        if -5.20000000000000009e-15 < y < 1.07999999999999999e-89

        1. Initial program 100.0%

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

          \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
        4. Step-by-step derivation
          1. +-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--.f6493.1

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

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

          \[\leadsto x + \color{blue}{x \cdot z} \]
        7. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto x \cdot z + x \]
          2. lower-fma.f6459.7

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

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

      Alternative 5: 53.7% accurate, 0.6× speedup?

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

        1. Initial program 100.0%

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

          \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
        4. Step-by-step derivation
          1. +-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--.f6490.0

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

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

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

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

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

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

            \[\leadsto \left(-t\right) \cdot z \]
        8. Applied rewrites49.3%

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

        if -2e147 < z < -0.0580000000000000029

        1. Initial program 100.0%

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

          \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
        4. Step-by-step derivation
          1. +-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--.f6467.4

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

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

          \[\leadsto x + \color{blue}{x \cdot z} \]
        7. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto x \cdot z + x \]
          2. lower-fma.f6433.0

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

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

        if -0.0580000000000000029 < z < 4.99999999999999975e60

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

          if 4.99999999999999975e60 < 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 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--.f6482.0

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

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

            \[\leadsto x + \color{blue}{x \cdot z} \]
          7. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto x \cdot z + x \]
            2. lower-fma.f6444.6

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

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

            \[\leadsto x \cdot z \]
          10. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto z \cdot x \]
            2. lower-*.f6444.6

              \[\leadsto z \cdot x \]
          11. Applied rewrites44.6%

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

        Alternative 6: 84.0% accurate, 0.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(-z, t - x, x\right)\\ \mathbf{if}\;z \leq -2 \cdot 10^{-7}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+51}:\\ \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (let* ((t_1 (fma (- z) (- t x) x)))
           (if (<= z -2e-7) t_1 (if (<= z 4.2e+51) (fma (- t x) y x) t_1))))
        double code(double x, double y, double z, double t) {
        	double t_1 = fma(-z, (t - x), x);
        	double tmp;
        	if (z <= -2e-7) {
        		tmp = t_1;
        	} else if (z <= 4.2e+51) {
        		tmp = fma((t - x), y, x);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        function code(x, y, z, t)
        	t_1 = fma(Float64(-z), Float64(t - x), x)
        	tmp = 0.0
        	if (z <= -2e-7)
        		tmp = t_1;
        	elseif (z <= 4.2e+51)
        		tmp = fma(Float64(t - x), y, x);
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-z) * N[(t - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -2e-7], t$95$1, If[LessEqual[z, 4.2e+51], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \mathsf{fma}\left(-z, t - x, x\right)\\
        \mathbf{if}\;z \leq -2 \cdot 10^{-7}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;z \leq 4.2 \cdot 10^{+51}:\\
        \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -1.9999999999999999e-7 or 4.2000000000000002e51 < 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 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--.f6479.8

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

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

          if -1.9999999999999999e-7 < z < 4.2000000000000002e51

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

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

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

        Alternative 7: 83.9% accurate, 0.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(-z\right) \cdot \left(t - x\right)\\ \mathbf{if}\;z \leq -3200000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+51}:\\ \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (let* ((t_1 (* (- z) (- t x))))
           (if (<= z -3200000000000.0) t_1 (if (<= z 4.2e+51) (fma (- t x) y x) t_1))))
        double code(double x, double y, double z, double t) {
        	double t_1 = -z * (t - x);
        	double tmp;
        	if (z <= -3200000000000.0) {
        		tmp = t_1;
        	} else if (z <= 4.2e+51) {
        		tmp = fma((t - x), y, x);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        function code(x, y, z, t)
        	t_1 = Float64(Float64(-z) * Float64(t - x))
        	tmp = 0.0
        	if (z <= -3200000000000.0)
        		tmp = t_1;
        	elseif (z <= 4.2e+51)
        		tmp = fma(Float64(t - x), y, x);
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-z) * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3200000000000.0], t$95$1, If[LessEqual[z, 4.2e+51], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \left(-z\right) \cdot \left(t - x\right)\\
        \mathbf{if}\;z \leq -3200000000000:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;z \leq 4.2 \cdot 10^{+51}:\\
        \;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -3.2e12 or 4.2000000000000002e51 < 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--.f6480.7

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

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

          if -3.2e12 < z < 4.2000000000000002e51

          1. Initial program 100.0%

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

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

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

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

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

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

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

        Alternative 8: 70.8% accurate, 0.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - x\right) \cdot y\\ \mathbf{if}\;y \leq -2.8 \cdot 10^{+66}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{-28}:\\ \;\;\;\;\mathsf{fma}\left(-z, t, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (let* ((t_1 (* (- t x) y)))
           (if (<= y -2.8e+66) t_1 (if (<= y 3.9e-28) (fma (- z) t x) t_1))))
        double code(double x, double y, double z, double t) {
        	double t_1 = (t - x) * y;
        	double tmp;
        	if (y <= -2.8e+66) {
        		tmp = t_1;
        	} else if (y <= 3.9e-28) {
        		tmp = fma(-z, t, x);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        function code(x, y, z, t)
        	t_1 = Float64(Float64(t - x) * y)
        	tmp = 0.0
        	if (y <= -2.8e+66)
        		tmp = t_1;
        	elseif (y <= 3.9e-28)
        		tmp = fma(Float64(-z), t, x);
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -2.8e+66], t$95$1, If[LessEqual[y, 3.9e-28], N[((-z) * t + x), $MachinePrecision], t$95$1]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := \left(t - x\right) \cdot y\\
        \mathbf{if}\;y \leq -2.8 \cdot 10^{+66}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;y \leq 3.9 \cdot 10^{-28}:\\
        \;\;\;\;\mathsf{fma}\left(-z, t, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -2.8000000000000001e66 or 3.89999999999999999e-28 < 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--.f6478.3

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

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

          if -2.8000000000000001e66 < y < 3.89999999999999999e-28

          1. Initial program 100.0%

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

            \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
          4. Step-by-step derivation
            1. +-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--.f6487.2

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

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

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

              \[\leadsto \mathsf{fma}\left(-z, t, x\right) \]
          8. Recombined 2 regimes into one program.
          9. Add Preprocessing

          Alternative 9: 68.3% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - x\right) \cdot y\\ \mathbf{if}\;y \leq -4.5 \cdot 10^{-13}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 5.4:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
          (FPCore (x y z t)
           :precision binary64
           (let* ((t_1 (* (- t x) y)))
             (if (<= y -4.5e-13) t_1 (if (<= y 5.4) (fma x z x) t_1))))
          double code(double x, double y, double z, double t) {
          	double t_1 = (t - x) * y;
          	double tmp;
          	if (y <= -4.5e-13) {
          		tmp = t_1;
          	} else if (y <= 5.4) {
          		tmp = fma(x, z, x);
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          function code(x, y, z, t)
          	t_1 = Float64(Float64(t - x) * y)
          	tmp = 0.0
          	if (y <= -4.5e-13)
          		tmp = t_1;
          	elseif (y <= 5.4)
          		tmp = fma(x, z, x);
          	else
          		tmp = t_1;
          	end
          	return tmp
          end
          
          code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -4.5e-13], t$95$1, If[LessEqual[y, 5.4], N[(x * z + x), $MachinePrecision], t$95$1]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_1 := \left(t - x\right) \cdot y\\
          \mathbf{if}\;y \leq -4.5 \cdot 10^{-13}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;y \leq 5.4:\\
          \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_1\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < -4.5e-13 or 5.4000000000000004 < 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.7

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

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

            if -4.5e-13 < y < 5.4000000000000004

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
            4. Step-by-step derivation
              1. +-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--.f6491.2

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

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

              \[\leadsto x + \color{blue}{x \cdot z} \]
            7. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto x \cdot z + x \]
              2. lower-fma.f6458.5

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

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

          Alternative 10: 53.7% accurate, 0.8× speedup?

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

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
            4. Step-by-step derivation
              1. +-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--.f6479.4

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

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

              \[\leadsto x + \color{blue}{x \cdot z} \]
            7. Step-by-step derivation
              1. +-commutativeN/A

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

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

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

            if -0.0580000000000000029 < z < 4.99999999999999975e60

            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

              if 4.99999999999999975e60 < 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 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--.f6482.0

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

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

                \[\leadsto x + \color{blue}{x \cdot z} \]
              7. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto x \cdot z + x \]
                2. lower-fma.f6444.6

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

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

                \[\leadsto x \cdot z \]
              10. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto z \cdot x \]
                2. lower-*.f6444.6

                  \[\leadsto z \cdot x \]
              11. Applied rewrites44.6%

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

            Alternative 11: 45.8% accurate, 0.8× speedup?

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

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

                  \[\leadsto \left(t - x\right) \cdot y \]
              5. Applied rewrites48.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 rewrites43.3%

                  \[\leadsto t \cdot y \]

                if -3.49999999999999994e80 < t < 7.89999999999999999e80

                1. Initial program 100.0%

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

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

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

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

                  \[\leadsto x + \color{blue}{x \cdot z} \]
                7. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto x \cdot z + x \]
                  2. lower-fma.f6447.3

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

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

              Alternative 12: 37.0% accurate, 0.8× speedup?

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

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

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

                  \[\leadsto x + \color{blue}{x \cdot z} \]
                7. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto x \cdot z + x \]
                  2. lower-fma.f6441.8

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

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

                  \[\leadsto x \cdot z \]
                10. Step-by-step derivation
                  1. *-commutativeN/A

                    \[\leadsto z \cdot x \]
                  2. lower-*.f6441.5

                    \[\leadsto z \cdot x \]
                11. Applied rewrites41.5%

                  \[\leadsto z \cdot x \]

                if -1 < z < 1.15e17

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

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

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

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

                Alternative 13: 18.2% 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.7

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

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

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

                    \[\leadsto x \]
                  2. Add Preprocessing

                  Developer Target 1: 96.3% 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 2025091 
                  (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))))