Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 2.3s
Alternatives: 9
Speedup: 1.1×

Specification

?
\[x + \left(y - z\right) \cdot \left(t - x\right) \]
(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]
x + \left(y - z\right) \cdot \left(t - x\right)

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 9 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?

\[x + \left(y - z\right) \cdot \left(t - x\right) \]
(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]
x + \left(y - z\right) \cdot \left(t - x\right)

Alternative 1: 100.0% accurate, 1.1× speedup?

\[\mathsf{fma}\left(z - y, x - t, x\right) \]
(FPCore (x y z t)
  :precision binary64
  (fma (- z y) (- x t) x))
double code(double x, double y, double z, double t) {
	return fma((z - y), (x - t), x);
}
function code(x, y, z, t)
	return fma(Float64(z - y), Float64(x - t), x)
end
code[x_, y_, z_, t_] := N[(N[(z - y), $MachinePrecision] * N[(x - t), $MachinePrecision] + x), $MachinePrecision]
\mathsf{fma}\left(z - y, x - t, x\right)
Derivation
  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 85.2% accurate, 0.7× speedup?

\[\begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -8.2 \cdot 10^{+30}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 0.00027:\\ \;\;\;\;\mathsf{fma}\left(z, x - t, x\right)\\ \mathbf{else}:\\ \;\;\;\;x + t\_1\\ \end{array} \]
(FPCore (x y z t)
  :precision binary64
  (let* ((t_1 (* y (- t x))))
  (if (<= y -8.2e+30)
    t_1
    (if (<= y 0.00027) (fma z (- x t) x) (+ x t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double tmp;
	if (y <= -8.2e+30) {
		tmp = t_1;
	} else if (y <= 0.00027) {
		tmp = fma(z, (x - t), x);
	} else {
		tmp = x + t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(y * Float64(t - x))
	tmp = 0.0
	if (y <= -8.2e+30)
		tmp = t_1;
	elseif (y <= 0.00027)
		tmp = fma(z, Float64(x - t), x);
	else
		tmp = Float64(x + 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, -8.2e+30], t$95$1, If[LessEqual[y, 0.00027], N[(z * N[(x - t), $MachinePrecision] + x), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -8.2 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\

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

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -8.2000000000000001e30

    1. Initial program 100.0%

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

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{t} \]
    3. Step-by-step derivation
      1. Applied rewrites64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -8.2000000000000001e30 < y < 2.7e-4

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 2.7e-4 < y

        1. Initial program 100.0%

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

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

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

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

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

      Alternative 3: 85.0% accurate, 0.7× speedup?

      \[\begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -8.2 \cdot 10^{+30}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 0.00027:\\ \;\;\;\;\mathsf{fma}\left(z, x - t, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
      (FPCore (x y z t)
        :precision binary64
        (let* ((t_1 (* y (- t x))))
        (if (<= y -8.2e+30) t_1 (if (<= y 0.00027) (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 <= -8.2e+30) {
      		tmp = t_1;
      	} else if (y <= 0.00027) {
      		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 <= -8.2e+30)
      		tmp = t_1;
      	elseif (y <= 0.00027)
      		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, -8.2e+30], t$95$1, If[LessEqual[y, 0.00027], N[(z * N[(x - t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
      
      \begin{array}{l}
      t_1 := y \cdot \left(t - x\right)\\
      \mathbf{if}\;y \leq -8.2 \cdot 10^{+30}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;y \leq 0.00027:\\
      \;\;\;\;\mathsf{fma}\left(z, x - t, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -8.2000000000000001e30 or 2.7e-4 < y

        1. Initial program 100.0%

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

          \[\leadsto x + \left(y - z\right) \cdot \color{blue}{t} \]
        3. Step-by-step derivation
          1. Applied rewrites64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -8.2000000000000001e30 < y < 2.7e-4

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 4: 76.4% accurate, 0.7× speedup?

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

            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto x + x \cdot \color{blue}{\left(z - y\right)} \]
              3. lower--.f6455.5%

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

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

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

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

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

                \[\leadsto \left(z - y\right) \cdot x + \color{blue}{x} \]
              5. lower-fma.f6455.5%

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

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

            if -7.5000000000000003e-46 < x < 1.7e22

            1. Initial program 100.0%

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

              \[\leadsto x + \left(y - z\right) \cdot \color{blue}{t} \]
            3. Step-by-step derivation
              1. Applied rewrites64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(t, y, \mathsf{fma}\left(-z, t, x\right)\right)} \]
              4. Step-by-step derivation
                1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\left(y - z\right) \cdot t} + x \]
                10. lower-fma.f6464.9%

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

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

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

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

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

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

            Alternative 5: 68.5% accurate, 0.4× speedup?

            \[\begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ t_2 := t \cdot \left(y - z\right)\\ \mathbf{if}\;y \leq -4.6 \cdot 10^{+31}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -7.1 \cdot 10^{-78}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -7.8 \cdot 10^{-130}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-290}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-114}:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{-5}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
            (FPCore (x y z t)
              :precision binary64
              (let* ((t_1 (* y (- t x))) (t_2 (* t (- y z))))
              (if (<= y -4.6e+31)
                t_1
                (if (<= y -7.1e-78)
                  t_2
                  (if (<= y -7.8e-130)
                    (fma z x x)
                    (if (<= y 9.8e-290)
                      (* z (- x t))
                      (if (<= y 3.5e-114)
                        (fma z x x)
                        (if (<= y 8.5e-5) t_2 t_1))))))))
            double code(double x, double y, double z, double t) {
            	double t_1 = y * (t - x);
            	double t_2 = t * (y - z);
            	double tmp;
            	if (y <= -4.6e+31) {
            		tmp = t_1;
            	} else if (y <= -7.1e-78) {
            		tmp = t_2;
            	} else if (y <= -7.8e-130) {
            		tmp = fma(z, x, x);
            	} else if (y <= 9.8e-290) {
            		tmp = z * (x - t);
            	} else if (y <= 3.5e-114) {
            		tmp = fma(z, x, x);
            	} else if (y <= 8.5e-5) {
            		tmp = t_2;
            	} else {
            		tmp = t_1;
            	}
            	return tmp;
            }
            
            function code(x, y, z, t)
            	t_1 = Float64(y * Float64(t - x))
            	t_2 = Float64(t * Float64(y - z))
            	tmp = 0.0
            	if (y <= -4.6e+31)
            		tmp = t_1;
            	elseif (y <= -7.1e-78)
            		tmp = t_2;
            	elseif (y <= -7.8e-130)
            		tmp = fma(z, x, x);
            	elseif (y <= 9.8e-290)
            		tmp = Float64(z * Float64(x - t));
            	elseif (y <= 3.5e-114)
            		tmp = fma(z, x, x);
            	elseif (y <= 8.5e-5)
            		tmp = t_2;
            	else
            		tmp = t_1;
            	end
            	return tmp
            end
            
            code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.6e+31], t$95$1, If[LessEqual[y, -7.1e-78], t$95$2, If[LessEqual[y, -7.8e-130], N[(z * x + x), $MachinePrecision], If[LessEqual[y, 9.8e-290], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.5e-114], N[(z * x + x), $MachinePrecision], If[LessEqual[y, 8.5e-5], t$95$2, t$95$1]]]]]]]]
            
            \begin{array}{l}
            t_1 := y \cdot \left(t - x\right)\\
            t_2 := t \cdot \left(y - z\right)\\
            \mathbf{if}\;y \leq -4.6 \cdot 10^{+31}:\\
            \;\;\;\;t\_1\\
            
            \mathbf{elif}\;y \leq -7.1 \cdot 10^{-78}:\\
            \;\;\;\;t\_2\\
            
            \mathbf{elif}\;y \leq -7.8 \cdot 10^{-130}:\\
            \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
            
            \mathbf{elif}\;y \leq 9.8 \cdot 10^{-290}:\\
            \;\;\;\;z \cdot \left(x - t\right)\\
            
            \mathbf{elif}\;y \leq 3.5 \cdot 10^{-114}:\\
            \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
            
            \mathbf{elif}\;y \leq 8.5 \cdot 10^{-5}:\\
            \;\;\;\;t\_2\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_1\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 4 regimes
            2. if y < -4.5999999999999999e31 or 8.5000000000000006e-5 < y

              1. Initial program 100.0%

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

                \[\leadsto x + \left(y - z\right) \cdot \color{blue}{t} \]
              3. Step-by-step derivation
                1. Applied rewrites64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if -4.5999999999999999e31 < y < -7.1000000000000002e-78 or 3.5e-114 < y < 8.5000000000000006e-5

                1. Initial program 100.0%

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

                  \[\leadsto x + \left(y - z\right) \cdot \color{blue}{t} \]
                3. Step-by-step derivation
                  1. Applied rewrites64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(t, y, \mathsf{fma}\left(-z, t, x\right)\right)} \]
                  4. Step-by-step derivation
                    1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{\left(y - z\right) \cdot t} + x \]
                    10. lower-fma.f6464.9%

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

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

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

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

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

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

                  if -7.1000000000000002e-78 < y < -7.8000000000000002e-130 or 9.8000000000000002e-290 < y < 3.5e-114

                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto x + x \cdot \color{blue}{\left(z - y\right)} \]
                    3. lower--.f6455.5%

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

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

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

                      \[\leadsto x + x \cdot \color{blue}{z} \]
                    2. lower-*.f6437.2%

                      \[\leadsto x + x \cdot z \]
                  9. Applied rewrites37.2%

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

                      \[\leadsto x + x \cdot \color{blue}{z} \]
                    2. lift-*.f64N/A

                      \[\leadsto x + x \cdot z \]
                    3. *-commutativeN/A

                      \[\leadsto x + z \cdot x \]
                    4. +-commutativeN/A

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

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

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

                  if -7.8000000000000002e-130 < y < 9.8000000000000002e-290

                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 6: 68.3% accurate, 0.5× speedup?

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

                  1. Initial program 100.0%

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

                    \[\leadsto x + \left(y - z\right) \cdot \color{blue}{t} \]
                  3. Step-by-step derivation
                    1. Applied rewrites64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    if -4.5999999999999999e31 < y < -7.1000000000000002e-78 or 3.5e-114 < y < 8.5000000000000006e-5

                    1. Initial program 100.0%

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

                      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{t} \]
                    3. Step-by-step derivation
                      1. Applied rewrites64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(t, y, \mathsf{fma}\left(-z, t, x\right)\right)} \]
                      4. Step-by-step derivation
                        1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\left(y - z\right) \cdot t} + x \]
                        10. lower-fma.f6464.9%

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

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

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

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

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

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

                      if -7.1000000000000002e-78 < y < 3.5e-114

                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto x + x \cdot \color{blue}{\left(z - y\right)} \]
                        3. lower--.f6455.5%

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

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

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

                          \[\leadsto x + x \cdot \color{blue}{z} \]
                        2. lower-*.f6437.2%

                          \[\leadsto x + x \cdot z \]
                      9. Applied rewrites37.2%

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

                          \[\leadsto x + x \cdot \color{blue}{z} \]
                        2. lift-*.f64N/A

                          \[\leadsto x + x \cdot z \]
                        3. *-commutativeN/A

                          \[\leadsto x + z \cdot x \]
                        4. +-commutativeN/A

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

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

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

                    Alternative 7: 67.9% accurate, 0.8× speedup?

                    \[\begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -8.2 \cdot 10^{+30}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 0.00027:\\ \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
                    (FPCore (x y z t)
                      :precision binary64
                      (let* ((t_1 (* y (- t x))))
                      (if (<= y -8.2e+30) t_1 (if (<= y 0.00027) (fma z x x) t_1))))
                    double code(double x, double y, double z, double t) {
                    	double t_1 = y * (t - x);
                    	double tmp;
                    	if (y <= -8.2e+30) {
                    		tmp = t_1;
                    	} else if (y <= 0.00027) {
                    		tmp = fma(z, x, 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 <= -8.2e+30)
                    		tmp = t_1;
                    	elseif (y <= 0.00027)
                    		tmp = fma(z, x, 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, -8.2e+30], t$95$1, If[LessEqual[y, 0.00027], N[(z * x + x), $MachinePrecision], t$95$1]]]
                    
                    \begin{array}{l}
                    t_1 := y \cdot \left(t - x\right)\\
                    \mathbf{if}\;y \leq -8.2 \cdot 10^{+30}:\\
                    \;\;\;\;t\_1\\
                    
                    \mathbf{elif}\;y \leq 0.00027:\\
                    \;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t\_1\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if y < -8.2000000000000001e30 or 2.7e-4 < y

                      1. Initial program 100.0%

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

                        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{t} \]
                      3. Step-by-step derivation
                        1. Applied rewrites64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        if -8.2000000000000001e30 < y < 2.7e-4

                        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto x + x \cdot \color{blue}{\left(z - y\right)} \]
                          3. lower--.f6455.5%

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

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

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

                            \[\leadsto x + x \cdot \color{blue}{z} \]
                          2. lower-*.f6437.2%

                            \[\leadsto x + x \cdot z \]
                        9. Applied rewrites37.2%

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

                            \[\leadsto x + x \cdot \color{blue}{z} \]
                          2. lift-*.f64N/A

                            \[\leadsto x + x \cdot z \]
                          3. *-commutativeN/A

                            \[\leadsto x + z \cdot x \]
                          4. +-commutativeN/A

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

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

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

                      Alternative 8: 37.2% accurate, 2.0× speedup?

                      \[\mathsf{fma}\left(z, x, x\right) \]
                      (FPCore (x y z t)
                        :precision binary64
                        (fma z x x))
                      double code(double x, double y, double z, double t) {
                      	return fma(z, x, x);
                      }
                      
                      function code(x, y, z, t)
                      	return fma(z, x, x)
                      end
                      
                      code[x_, y_, z_, t_] := N[(z * x + x), $MachinePrecision]
                      
                      \mathsf{fma}\left(z, x, x\right)
                      
                      Derivation
                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto x + x \cdot \color{blue}{\left(z - y\right)} \]
                        3. lower--.f6455.5%

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

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

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

                          \[\leadsto x + x \cdot \color{blue}{z} \]
                        2. lower-*.f6437.2%

                          \[\leadsto x + x \cdot z \]
                      9. Applied rewrites37.2%

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

                          \[\leadsto x + x \cdot \color{blue}{z} \]
                        2. lift-*.f64N/A

                          \[\leadsto x + x \cdot z \]
                        3. *-commutativeN/A

                          \[\leadsto x + z \cdot x \]
                        4. +-commutativeN/A

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

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

                        \[\leadsto \mathsf{fma}\left(z, x, x\right) \]
                      12. Add Preprocessing

                      Alternative 9: 21.8% accurate, 2.9× speedup?

                      \[x \cdot z \]
                      (FPCore (x y z t)
                        :precision binary64
                        (* x z))
                      double code(double x, double y, double z, double t) {
                      	return x * z;
                      }
                      
                      module fmin_fmax_functions
                          implicit none
                          private
                          public fmax
                          public fmin
                      
                          interface fmax
                              module procedure fmax88
                              module procedure fmax44
                              module procedure fmax84
                              module procedure fmax48
                          end interface
                          interface fmin
                              module procedure fmin88
                              module procedure fmin44
                              module procedure fmin84
                              module procedure fmin48
                          end interface
                      contains
                          real(8) function fmax88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmax44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmax84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmax48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                          end function
                          real(8) function fmin88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmin44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmin84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmin48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                          end function
                      end module
                      
                      real(8) function code(x, y, z, t)
                      use fmin_fmax_functions
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8), intent (in) :: z
                          real(8), intent (in) :: t
                          code = x * z
                      end function
                      
                      public static double code(double x, double y, double z, double t) {
                      	return x * z;
                      }
                      
                      def code(x, y, z, t):
                      	return x * z
                      
                      function code(x, y, z, t)
                      	return Float64(x * z)
                      end
                      
                      function tmp = code(x, y, z, t)
                      	tmp = x * z;
                      end
                      
                      code[x_, y_, z_, t_] := N[(x * z), $MachinePrecision]
                      
                      x \cdot z
                      
                      Derivation
                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto x \cdot \color{blue}{z} \]
                      8. Step-by-step derivation
                        1. lower-*.f6421.8%

                          \[\leadsto x \cdot z \]
                      9. Applied rewrites21.8%

                        \[\leadsto x \cdot \color{blue}{z} \]
                      10. Add Preprocessing

                      Reproduce

                      ?
                      herbie shell --seed 2025212 
                      (FPCore (x y z t)
                        :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
                        :precision binary64
                        (+ x (* (- y z) (- t x))))