Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 3.1s
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: 37.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y - z \leq -9 \cdot 10^{-5}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;y - z \leq 4000000000000:\\ \;\;\;\;x\\ \mathbf{elif}\;y - z \leq 5 \cdot 10^{+159}:\\ \;\;\;\;x \cdot z\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (- y z) -9e-5)
   (* x z)
   (if (<= (- y z) 4000000000000.0)
     x
     (if (<= (- y z) 5e+159) (* x z) (* y t)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y - z) <= -9e-5) {
		tmp = x * z;
	} else if ((y - z) <= 4000000000000.0) {
		tmp = x;
	} else if ((y - z) <= 5e+159) {
		tmp = x * z;
	} else {
		tmp = y * t;
	}
	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) <= (-9d-5)) then
        tmp = x * z
    else if ((y - z) <= 4000000000000.0d0) then
        tmp = x
    else if ((y - z) <= 5d+159) then
        tmp = x * z
    else
        tmp = y * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y - z) <= -9e-5) {
		tmp = x * z;
	} else if ((y - z) <= 4000000000000.0) {
		tmp = x;
	} else if ((y - z) <= 5e+159) {
		tmp = x * z;
	} else {
		tmp = y * t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y - z) <= -9e-5:
		tmp = x * z
	elif (y - z) <= 4000000000000.0:
		tmp = x
	elif (y - z) <= 5e+159:
		tmp = x * z
	else:
		tmp = y * t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(y - z) <= -9e-5)
		tmp = Float64(x * z);
	elseif (Float64(y - z) <= 4000000000000.0)
		tmp = x;
	elseif (Float64(y - z) <= 5e+159)
		tmp = Float64(x * z);
	else
		tmp = Float64(y * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y - z) <= -9e-5)
		tmp = x * z;
	elseif ((y - z) <= 4000000000000.0)
		tmp = x;
	elseif ((y - z) <= 5e+159)
		tmp = x * z;
	else
		tmp = y * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[N[(y - z), $MachinePrecision], -9e-5], N[(x * z), $MachinePrecision], If[LessEqual[N[(y - z), $MachinePrecision], 4000000000000.0], x, If[LessEqual[N[(y - z), $MachinePrecision], 5e+159], N[(x * z), $MachinePrecision], N[(y * t), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -9 \cdot 10^{-5}:\\
\;\;\;\;x \cdot z\\

\mathbf{elif}\;y - z \leq 4000000000000:\\
\;\;\;\;x\\

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

\mathbf{else}:\\
\;\;\;\;y \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 y z) < -9.00000000000000057e-5 or 4e12 < (-.f64 y z) < 5.00000000000000003e159

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

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

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

      \[\leadsto x \cdot \color{blue}{z} \]
    7. Step-by-step derivation
      1. lower-*.f6433.0

        \[\leadsto x \cdot z \]
    8. Applied rewrites33.0%

      \[\leadsto x \cdot \color{blue}{z} \]

    if -9.00000000000000057e-5 < (-.f64 y z) < 4e12

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

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

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

        \[\leadsto x \]

      if 5.00000000000000003e159 < (-.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 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--.f6461.4

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

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

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

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

      Alternative 3: 73.0% accurate, 0.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_1 := \mathsf{fma}\left(t - x, y, x\right)\\ \mathbf{if}\;y \leq -1.2 \cdot 10^{-8}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -1.96 \cdot 10^{-97}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{-29}:\\ \;\;\;\;\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 (fma (- t x) y x)))
         (if (<= y -1.2e-8)
           t_1
           (if (<= y -1.96e-97)
             (fma z x x)
             (if (<= y 2.6e-29) (fma (- z) t x) t_1)))))
      double code(double x, double y, double z, double t) {
      	double t_1 = fma((t - x), y, x);
      	double tmp;
      	if (y <= -1.2e-8) {
      		tmp = t_1;
      	} else if (y <= -1.96e-97) {
      		tmp = fma(z, x, x);
      	} else if (y <= 2.6e-29) {
      		tmp = fma(-z, t, x);
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      function code(x, y, z, t)
      	t_1 = fma(Float64(t - x), y, x)
      	tmp = 0.0
      	if (y <= -1.2e-8)
      		tmp = t_1;
      	elseif (y <= -1.96e-97)
      		tmp = fma(z, x, x);
      	elseif (y <= 2.6e-29)
      		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 + x), $MachinePrecision]}, If[LessEqual[y, -1.2e-8], t$95$1, If[LessEqual[y, -1.96e-97], N[(z * x + x), $MachinePrecision], If[LessEqual[y, 2.6e-29], N[((-z) * t + x), $MachinePrecision], t$95$1]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_1 := \mathsf{fma}\left(t - x, y, x\right)\\
      \mathbf{if}\;y \leq -1.2 \cdot 10^{-8}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;y \leq -1.96 \cdot 10^{-97}:\\
      \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
      
      \mathbf{elif}\;y \leq 2.6 \cdot 10^{-29}:\\
      \;\;\;\;\mathsf{fma}\left(-z, t, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y < -1.19999999999999999e-8 or 2.6000000000000002e-29 < y

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

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

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

        if -1.19999999999999999e-8 < y < -1.96000000000000006e-97

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

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

          \[\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. *-commutativeN/A

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

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

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

        if -1.96000000000000006e-97 < y < 2.6000000000000002e-29

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

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

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

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

        Alternative 4: 72.6% accurate, 0.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(t - x\right) \cdot y\\ \mathbf{if}\;y \leq -3.1 \cdot 10^{-5}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -1.96 \cdot 10^{-97}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{-8}:\\ \;\;\;\;\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 -3.1e-5)
             t_1
             (if (<= y -1.96e-97)
               (fma z x x)
               (if (<= y 5.6e-8) (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 <= -3.1e-5) {
        		tmp = t_1;
        	} else if (y <= -1.96e-97) {
        		tmp = fma(z, x, x);
        	} else if (y <= 5.6e-8) {
        		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 <= -3.1e-5)
        		tmp = t_1;
        	elseif (y <= -1.96e-97)
        		tmp = fma(z, x, x);
        	elseif (y <= 5.6e-8)
        		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, -3.1e-5], t$95$1, If[LessEqual[y, -1.96e-97], N[(z * x + x), $MachinePrecision], If[LessEqual[y, 5.6e-8], 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 -3.1 \cdot 10^{-5}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;y \leq -1.96 \cdot 10^{-97}:\\
        \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
        
        \mathbf{elif}\;y \leq 5.6 \cdot 10^{-8}:\\
        \;\;\;\;\mathsf{fma}\left(-z, t, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y < -3.10000000000000014e-5 or 5.5999999999999999e-8 < 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.3

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

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

          if -3.10000000000000014e-5 < y < -1.96000000000000006e-97

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

              \[\leadsto \mathsf{fma}\left(-z, t - \color{blue}{x}, x\right) \]
          5. Applied rewrites89.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. *-commutativeN/A

              \[\leadsto z \cdot x + x \]
            3. lower-fma.f6481.1

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

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

          if -1.96000000000000006e-97 < y < 5.5999999999999999e-8

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

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

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

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

          Alternative 5: 68.2% accurate, 0.6× speedup?

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

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

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

            if -3.10000000000000014e-5 < y < 4.9999999999999998e-39

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

                \[\leadsto \mathsf{fma}\left(-z, t - \color{blue}{x}, x\right) \]
            5. Applied rewrites95.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. *-commutativeN/A

                \[\leadsto z \cdot x + x \]
              3. lower-fma.f6466.1

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

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

            if 4.9999999999999998e-39 < y < 1.4500000000000001e77

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

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

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

          Alternative 6: 84.5% accurate, 0.6× speedup?

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

            1. Initial program 100.0%

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

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

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

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

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

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

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

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

            if -4e11 < z < 1.70000000000000001e-18

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

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

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

            if 1.70000000000000001e-18 < 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--.f6487.0

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

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

          Alternative 7: 84.5% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -400000000000 \lor \neg \left(z \leq 560\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 -400000000000.0) (not (<= z 560.0)))
             (* (- z) (- t x))
             (fma (- t x) y x)))
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((z <= -400000000000.0) || !(z <= 560.0)) {
          		tmp = -z * (t - x);
          	} else {
          		tmp = fma((t - x), y, x);
          	}
          	return tmp;
          }
          
          function code(x, y, z, t)
          	tmp = 0.0
          	if ((z <= -400000000000.0) || !(z <= 560.0))
          		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, -400000000000.0], N[Not[LessEqual[z, 560.0]], $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 -400000000000 \lor \neg \left(z \leq 560\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 < -4e11 or 560 < 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--.f6484.6

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

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

            if -4e11 < z < 560

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

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -400000000000 \lor \neg \left(z \leq 560\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 8: 68.6% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{-5} \lor \neg \left(y \leq 6.4 \cdot 10^{-9}\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 -3.1e-5) (not (<= y 6.4e-9))) (* (- t x) y) (fma z x x)))
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((y <= -3.1e-5) || !(y <= 6.4e-9)) {
          		tmp = (t - x) * y;
          	} else {
          		tmp = fma(z, x, x);
          	}
          	return tmp;
          }
          
          function code(x, y, z, t)
          	tmp = 0.0
          	if ((y <= -3.1e-5) || !(y <= 6.4e-9))
          		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, -3.1e-5], N[Not[LessEqual[y, 6.4e-9]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision], N[(z * x + x), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y \leq -3.1 \cdot 10^{-5} \lor \neg \left(y \leq 6.4 \cdot 10^{-9}\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 < -3.10000000000000014e-5 or 6.40000000000000023e-9 < 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.3

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

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

            if -3.10000000000000014e-5 < y < 6.40000000000000023e-9

            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--.f6495.3

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

              \[\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. *-commutativeN/A

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

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

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

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

          Alternative 9: 54.7% accurate, 0.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.85 \cdot 10^{-14} \lor \neg \left(z \leq 1.7 \cdot 10^{-18}\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 -1.85e-14) (not (<= z 1.7e-18))) (fma z x x) (fma t y x)))
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if ((z <= -1.85e-14) || !(z <= 1.7e-18)) {
          		tmp = fma(z, x, x);
          	} else {
          		tmp = fma(t, y, x);
          	}
          	return tmp;
          }
          
          function code(x, y, z, t)
          	tmp = 0.0
          	if ((z <= -1.85e-14) || !(z <= 1.7e-18))
          		tmp = fma(z, x, x);
          	else
          		tmp = fma(t, y, x);
          	end
          	return tmp
          end
          
          code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.85e-14], N[Not[LessEqual[z, 1.7e-18]], $MachinePrecision]], N[(z * x + x), $MachinePrecision], N[(t * y + x), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;z \leq -1.85 \cdot 10^{-14} \lor \neg \left(z \leq 1.7 \cdot 10^{-18}\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 < -1.85000000000000001e-14 or 1.70000000000000001e-18 < 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.7

                \[\leadsto \mathsf{fma}\left(-z, t - \color{blue}{x}, x\right) \]
            5. Applied rewrites82.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. *-commutativeN/A

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

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

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

            if -1.85000000000000001e-14 < z < 1.70000000000000001e-18

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

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

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

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

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

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

            Alternative 10: 50.8% accurate, 0.8× speedup?

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

              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--.f6452.3

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

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

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

                  \[\leadsto y \cdot t \]

                if -3.10000000000000014e-5 < y < 6.40000000000000023e-9

                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--.f6495.3

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

                  \[\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. *-commutativeN/A

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

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

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

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

              Alternative 11: 54.0% accurate, 0.8× speedup?

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

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

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

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

                  \[\leadsto \left(-z\right) \cdot t \]
                7. Step-by-step derivation
                  1. Applied rewrites45.3%

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

                  if -1.12000000000000002e-20 < z < 1.70000000000000001e-18

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

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

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

                    if 1.70000000000000001e-18 < 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--.f6487.0

                        \[\leadsto \mathsf{fma}\left(-z, t - \color{blue}{x}, x\right) \]
                    5. Applied rewrites87.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. *-commutativeN/A

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

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

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

                  Alternative 12: 38.2% accurate, 0.8× speedup?

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

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

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

                      \[\leadsto x \cdot \color{blue}{z} \]
                    7. Step-by-step derivation
                      1. lower-*.f6441.5

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

                      \[\leadsto x \cdot \color{blue}{z} \]

                    if -1 < z < 1

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

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

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

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

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

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

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

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

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

                        \[\leadsto x \]
                      2. Add Preprocessing

                      Reproduce

                      ?
                      herbie shell --seed 2025085 
                      (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))))