Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 8.3s
Alternatives: 10
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));
}
real(8) function code(x, y, z, t)
    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 10 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));
}
real(8) function code(x, y, z, t)
    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));
}
real(8) function code(x, y, z, t)
    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: 49.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(-x\right)\\ \mathbf{if}\;y \leq -2 \cdot 10^{+227}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -1.9 \cdot 10^{+87}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+51}:\\ \;\;\;\;\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 (* y (- x))))
   (if (<= y -2e+227)
     t_1
     (if (<= y -1.9e+87) (* y t) (if (<= y 2.4e+51) (fma x z x) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = y * -x;
	double tmp;
	if (y <= -2e+227) {
		tmp = t_1;
	} else if (y <= -1.9e+87) {
		tmp = y * t;
	} else if (y <= 2.4e+51) {
		tmp = fma(x, z, x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(y * Float64(-x))
	tmp = 0.0
	if (y <= -2e+227)
		tmp = t_1;
	elseif (y <= -1.9e+87)
		tmp = Float64(y * t);
	elseif (y <= 2.4e+51)
		tmp = fma(x, z, x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, If[LessEqual[y, -2e+227], t$95$1, If[LessEqual[y, -1.9e+87], N[(y * t), $MachinePrecision], If[LessEqual[y, 2.4e+51], N[(x * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := y \cdot \left(-x\right)\\
\mathbf{if}\;y \leq -2 \cdot 10^{+227}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq -1.9 \cdot 10^{+87}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;y \leq 2.4 \cdot 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.0000000000000002e227 or 2.3999999999999999e51 < 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. lower-*.f64N/A

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

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

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

      \[\leadsto y \cdot \left(-1 \cdot \color{blue}{x}\right) \]
    7. Step-by-step derivation
      1. Applied rewrites48.1%

        \[\leadsto y \cdot \left(-x\right) \]

      if -2.0000000000000002e227 < y < -1.90000000000000006e87

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

          \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
        2. lower--.f6483.6

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

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

        \[\leadsto t \cdot \color{blue}{y} \]
      7. Step-by-step derivation
        1. Applied rewrites57.7%

          \[\leadsto t \cdot \color{blue}{y} \]

        if -1.90000000000000006e87 < y < 2.3999999999999999e51

        1. Initial program 100.0%

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

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

            \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \left(y - z\right) + 1\right)} \]
          2. distribute-lft-inN/A

            \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \left(y - z\right)\right) + x \cdot 1} \]
          3. *-rgt-identityN/A

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

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

            \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{neg}\left(\left(y - z\right)\right)}, x\right) \]
          6. sub-negN/A

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

            \[\leadsto \mathsf{fma}\left(x, \mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)}\right), x\right) \]
          8. distribute-neg-inN/A

            \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
          9. unsub-negN/A

            \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) - y}, x\right) \]
          10. remove-double-negN/A

            \[\leadsto \mathsf{fma}\left(x, \color{blue}{z} - y, x\right) \]
          11. lower--.f6454.3

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

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

          \[\leadsto x + \color{blue}{x \cdot z} \]
        7. Step-by-step derivation
          1. Applied rewrites49.6%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{+227}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;y \leq -1.9 \cdot 10^{+87}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+51}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \]
        10. Add Preprocessing

        Alternative 3: 84.1% accurate, 0.7× speedup?

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

              \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
            2. lower--.f6480.7

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

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

          if -5.6e17 < y < 2.80000000000000005e51

          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 \color{blue}{-1 \cdot \left(z \cdot \left(t - x\right)\right) + x} \]
            2. mul-1-negN/A

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

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

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

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

              \[\leadsto \mathsf{fma}\left(z, \color{blue}{\mathsf{neg}\left(\left(t - x\right)\right)}, x\right) \]
            7. sub-negN/A

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

              \[\leadsto \mathsf{fma}\left(z, \mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + t\right)}\right), x\right) \]
            9. distribute-neg-inN/A

              \[\leadsto \mathsf{fma}\left(z, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(t\right)\right)}, x\right) \]
            10. unsub-negN/A

              \[\leadsto \mathsf{fma}\left(z, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) - t}, x\right) \]
            11. remove-double-negN/A

              \[\leadsto \mathsf{fma}\left(z, \color{blue}{x} - t, x\right) \]
            12. lower--.f6488.8

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

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

        Alternative 4: 74.3% accurate, 0.7× speedup?

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

          1. Initial program 100.0%

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

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

              \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \left(y - z\right) + 1\right)} \]
            2. distribute-lft-inN/A

              \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \left(y - z\right)\right) + x \cdot 1} \]
            3. *-rgt-identityN/A

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

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

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{neg}\left(\left(y - z\right)\right)}, x\right) \]
            6. sub-negN/A

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

              \[\leadsto \mathsf{fma}\left(x, \mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)}\right), x\right) \]
            8. distribute-neg-inN/A

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
            9. unsub-negN/A

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) - y}, x\right) \]
            10. remove-double-negN/A

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{z} - y, x\right) \]
            11. lower--.f6479.0

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

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

          if -2.3e16 < x < 4.99999999999999989e-114

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

              \[\leadsto \color{blue}{t \cdot \left(y - z\right)} \]
            2. lower--.f6478.7

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

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

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

        Alternative 5: 68.6% accurate, 0.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -2300:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{+36}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (let* ((t_1 (* z (- x t))))
           (if (<= z -2300.0) t_1 (if (<= z 4.6e+36) (* y (- t x)) t_1))))
        double code(double x, double y, double z, double t) {
        	double t_1 = z * (x - t);
        	double tmp;
        	if (z <= -2300.0) {
        		tmp = t_1;
        	} else if (z <= 4.6e+36) {
        		tmp = y * (t - x);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z, t)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8), intent (in) :: t
            real(8) :: t_1
            real(8) :: tmp
            t_1 = z * (x - t)
            if (z <= (-2300.0d0)) then
                tmp = t_1
            else if (z <= 4.6d+36) then
                tmp = y * (t - x)
            else
                tmp = t_1
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z, double t) {
        	double t_1 = z * (x - t);
        	double tmp;
        	if (z <= -2300.0) {
        		tmp = t_1;
        	} else if (z <= 4.6e+36) {
        		tmp = y * (t - x);
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        def code(x, y, z, t):
        	t_1 = z * (x - t)
        	tmp = 0
        	if z <= -2300.0:
        		tmp = t_1
        	elif z <= 4.6e+36:
        		tmp = y * (t - x)
        	else:
        		tmp = t_1
        	return tmp
        
        function code(x, y, z, t)
        	t_1 = Float64(z * Float64(x - t))
        	tmp = 0.0
        	if (z <= -2300.0)
        		tmp = t_1;
        	elseif (z <= 4.6e+36)
        		tmp = Float64(y * Float64(t - x));
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z, t)
        	t_1 = z * (x - t);
        	tmp = 0.0;
        	if (z <= -2300.0)
        		tmp = t_1;
        	elseif (z <= 4.6e+36)
        		tmp = y * (t - x);
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2300.0], t$95$1, If[LessEqual[z, 4.6e+36], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_1 := z \cdot \left(x - t\right)\\
        \mathbf{if}\;z \leq -2300:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;z \leq 4.6 \cdot 10^{+36}:\\
        \;\;\;\;y \cdot \left(t - x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -2300 or 4.59999999999999993e36 < 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. mul-1-negN/A

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

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

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

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

              \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(t - x\right)\right)\right)} \]
            6. sub-negN/A

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

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

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

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

              \[\leadsto z \cdot \left(\color{blue}{x} - t\right) \]
            11. lower--.f6482.6

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

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

          if -2300 < z < 4.59999999999999993e36

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

              \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
            2. lower--.f6463.9

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

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

        Alternative 6: 62.7% accurate, 0.7× speedup?

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

          1. Initial program 100.0%

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

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

              \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \left(y - z\right) + 1\right)} \]
            2. distribute-lft-inN/A

              \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \left(y - z\right)\right) + x \cdot 1} \]
            3. *-rgt-identityN/A

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

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

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{neg}\left(\left(y - z\right)\right)}, x\right) \]
            6. sub-negN/A

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

              \[\leadsto \mathsf{fma}\left(x, \mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)}\right), x\right) \]
            8. distribute-neg-inN/A

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
            9. unsub-negN/A

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) - y}, x\right) \]
            10. remove-double-negN/A

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{z} - y, x\right) \]
            11. lower--.f6487.3

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

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

            \[\leadsto x + \color{blue}{x \cdot z} \]
          7. Step-by-step derivation
            1. Applied rewrites62.3%

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

            if -2.4e16 < x < 3.4e14

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

                \[\leadsto \color{blue}{t \cdot \left(y - z\right)} \]
              2. lower--.f6472.9

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

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

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

          Alternative 7: 45.3% accurate, 0.7× speedup?

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

            1. Initial program 100.0%

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

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

                \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \left(y - z\right) + 1\right)} \]
              2. distribute-lft-inN/A

                \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \left(y - z\right)\right) + x \cdot 1} \]
              3. *-rgt-identityN/A

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

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

                \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{neg}\left(\left(y - z\right)\right)}, x\right) \]
              6. sub-negN/A

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

                \[\leadsto \mathsf{fma}\left(x, \mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)}\right), x\right) \]
              8. distribute-neg-inN/A

                \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
              9. unsub-negN/A

                \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) - y}, x\right) \]
              10. remove-double-negN/A

                \[\leadsto \mathsf{fma}\left(x, \color{blue}{z} - y, x\right) \]
              11. lower--.f6486.1

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

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

              \[\leadsto x + \color{blue}{x \cdot z} \]
            7. Step-by-step derivation
              1. Applied rewrites60.5%

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

              if -1950 < x < 4.8e11

              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. mul-1-negN/A

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

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

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

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

                  \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(t - x\right)\right)\right)} \]
                6. sub-negN/A

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

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

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

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

                  \[\leadsto z \cdot \left(\color{blue}{x} - t\right) \]
                11. lower--.f6450.6

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

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

                \[\leadsto z \cdot \left(-1 \cdot \color{blue}{t}\right) \]
              7. Step-by-step derivation
                1. Applied rewrites43.3%

                  \[\leadsto z \cdot \left(-t\right) \]
              8. Recombined 2 regimes into one program.
              9. Add Preprocessing

              Alternative 8: 50.2% accurate, 0.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{+87}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-30}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \end{array} \]
              (FPCore (x y z t)
               :precision binary64
               (if (<= y -1.9e+87) (* y t) (if (<= y 3.8e-30) (fma x z x) (* y t))))
              double code(double x, double y, double z, double t) {
              	double tmp;
              	if (y <= -1.9e+87) {
              		tmp = y * t;
              	} else if (y <= 3.8e-30) {
              		tmp = fma(x, z, x);
              	} else {
              		tmp = y * t;
              	}
              	return tmp;
              }
              
              function code(x, y, z, t)
              	tmp = 0.0
              	if (y <= -1.9e+87)
              		tmp = Float64(y * t);
              	elseif (y <= 3.8e-30)
              		tmp = fma(x, z, x);
              	else
              		tmp = Float64(y * t);
              	end
              	return tmp
              end
              
              code[x_, y_, z_, t_] := If[LessEqual[y, -1.9e+87], N[(y * t), $MachinePrecision], If[LessEqual[y, 3.8e-30], N[(x * z + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;y \leq -1.9 \cdot 10^{+87}:\\
              \;\;\;\;y \cdot t\\
              
              \mathbf{elif}\;y \leq 3.8 \cdot 10^{-30}:\\
              \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;y \cdot t\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y < -1.90000000000000006e87 or 3.8000000000000003e-30 < 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. lower-*.f64N/A

                    \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
                  2. lower--.f6477.4

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

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

                  \[\leadsto t \cdot \color{blue}{y} \]
                7. Step-by-step derivation
                  1. Applied rewrites43.7%

                    \[\leadsto t \cdot \color{blue}{y} \]

                  if -1.90000000000000006e87 < y < 3.8000000000000003e-30

                  1. Initial program 100.0%

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

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

                      \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \left(y - z\right) + 1\right)} \]
                    2. distribute-lft-inN/A

                      \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \left(y - z\right)\right) + x \cdot 1} \]
                    3. *-rgt-identityN/A

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

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

                      \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{neg}\left(\left(y - z\right)\right)}, x\right) \]
                    6. sub-negN/A

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

                      \[\leadsto \mathsf{fma}\left(x, \mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)}\right), x\right) \]
                    8. distribute-neg-inN/A

                      \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
                    9. unsub-negN/A

                      \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) - y}, x\right) \]
                    10. remove-double-negN/A

                      \[\leadsto \mathsf{fma}\left(x, \color{blue}{z} - y, x\right) \]
                    11. lower--.f6457.1

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

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

                    \[\leadsto x + \color{blue}{x \cdot z} \]
                  7. Step-by-step derivation
                    1. Applied rewrites51.9%

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

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

                  Alternative 9: 39.1% accurate, 0.8× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{+49}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{+119}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \end{array} \]
                  (FPCore (x y z t)
                   :precision binary64
                   (if (<= z -2.6e+49) (* x z) (if (<= z 4.5e+119) (* y t) (* x z))))
                  double code(double x, double y, double z, double t) {
                  	double tmp;
                  	if (z <= -2.6e+49) {
                  		tmp = x * z;
                  	} else if (z <= 4.5e+119) {
                  		tmp = y * t;
                  	} else {
                  		tmp = x * z;
                  	}
                  	return tmp;
                  }
                  
                  real(8) function code(x, y, z, t)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8), intent (in) :: z
                      real(8), intent (in) :: t
                      real(8) :: tmp
                      if (z <= (-2.6d+49)) then
                          tmp = x * z
                      else if (z <= 4.5d+119) then
                          tmp = y * t
                      else
                          tmp = x * z
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double y, double z, double t) {
                  	double tmp;
                  	if (z <= -2.6e+49) {
                  		tmp = x * z;
                  	} else if (z <= 4.5e+119) {
                  		tmp = y * t;
                  	} else {
                  		tmp = x * z;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y, z, t):
                  	tmp = 0
                  	if z <= -2.6e+49:
                  		tmp = x * z
                  	elif z <= 4.5e+119:
                  		tmp = y * t
                  	else:
                  		tmp = x * z
                  	return tmp
                  
                  function code(x, y, z, t)
                  	tmp = 0.0
                  	if (z <= -2.6e+49)
                  		tmp = Float64(x * z);
                  	elseif (z <= 4.5e+119)
                  		tmp = Float64(y * t);
                  	else
                  		tmp = Float64(x * z);
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y, z, t)
                  	tmp = 0.0;
                  	if (z <= -2.6e+49)
                  		tmp = x * z;
                  	elseif (z <= 4.5e+119)
                  		tmp = y * t;
                  	else
                  		tmp = x * z;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_, z_, t_] := If[LessEqual[z, -2.6e+49], N[(x * z), $MachinePrecision], If[LessEqual[z, 4.5e+119], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;z \leq -2.6 \cdot 10^{+49}:\\
                  \;\;\;\;x \cdot z\\
                  
                  \mathbf{elif}\;z \leq 4.5 \cdot 10^{+119}:\\
                  \;\;\;\;y \cdot t\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;x \cdot z\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if z < -2.59999999999999989e49 or 4.5000000000000002e119 < z

                    1. Initial program 100.0%

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

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

                        \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \left(y - z\right) + 1\right)} \]
                      2. distribute-lft-inN/A

                        \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \left(y - z\right)\right) + x \cdot 1} \]
                      3. *-rgt-identityN/A

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

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

                        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{neg}\left(\left(y - z\right)\right)}, x\right) \]
                      6. sub-negN/A

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

                        \[\leadsto \mathsf{fma}\left(x, \mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)}\right), x\right) \]
                      8. distribute-neg-inN/A

                        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
                      9. unsub-negN/A

                        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) - y}, x\right) \]
                      10. remove-double-negN/A

                        \[\leadsto \mathsf{fma}\left(x, \color{blue}{z} - y, x\right) \]
                      11. lower--.f6451.8

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

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

                      \[\leadsto x \cdot \color{blue}{z} \]
                    7. Step-by-step derivation
                      1. Applied rewrites43.6%

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

                      if -2.59999999999999989e49 < z < 4.5000000000000002e119

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

                          \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
                        2. lower--.f6459.5

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

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

                        \[\leadsto t \cdot \color{blue}{y} \]
                      7. Step-by-step derivation
                        1. Applied rewrites35.1%

                          \[\leadsto t \cdot \color{blue}{y} \]
                      8. Recombined 2 regimes into one program.
                      9. Final simplification38.6%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{+49}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{+119}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
                      10. Add Preprocessing

                      Alternative 10: 27.2% accurate, 2.5× speedup?

                      \[\begin{array}{l} \\ y \cdot t \end{array} \]
                      (FPCore (x y z t) :precision binary64 (* y t))
                      double code(double x, double y, double z, double t) {
                      	return y * t;
                      }
                      
                      real(8) function code(x, y, z, t)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8), intent (in) :: z
                          real(8), intent (in) :: t
                          code = y * t
                      end function
                      
                      public static double code(double x, double y, double z, double t) {
                      	return y * t;
                      }
                      
                      def code(x, y, z, t):
                      	return y * t
                      
                      function code(x, y, z, t)
                      	return Float64(y * t)
                      end
                      
                      function tmp = code(x, y, z, t)
                      	tmp = y * t;
                      end
                      
                      code[x_, y_, z_, t_] := N[(y * t), $MachinePrecision]
                      
                      \begin{array}{l}
                      
                      \\
                      y \cdot t
                      \end{array}
                      
                      Derivation
                      1. Initial program 100.0%

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

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

                          \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
                        2. lower--.f6444.5

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

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

                        \[\leadsto t \cdot \color{blue}{y} \]
                      7. Step-by-step derivation
                        1. Applied rewrites25.7%

                          \[\leadsto t \cdot \color{blue}{y} \]
                        2. Final simplification25.7%

                          \[\leadsto y \cdot t \]
                        3. 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)));
                        }
                        
                        real(8) function code(x, y, z, t)
                            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 2024232 
                        (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))))