Optimisation.CirclePacking:place from circle-packing-0.1.0.4, H

Percentage Accurate: 100.0% → 100.0%
Time: 2.0s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(x + y\right) \cdot \left(1 - z\right) \end{array} \]
(FPCore (x y z) :precision binary64 (* (+ x y) (- 1.0 z)))
double code(double x, double y, double z) {
	return (x + y) * (1.0 - 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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + y) * (1.0d0 - z)
end function
public static double code(double x, double y, double z) {
	return (x + y) * (1.0 - z);
}
def code(x, y, z):
	return (x + y) * (1.0 - z)
function code(x, y, z)
	return Float64(Float64(x + y) * Float64(1.0 - z))
end
function tmp = code(x, y, z)
	tmp = (x + y) * (1.0 - z);
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

\[\begin{array}{l} \\ \left(x + y\right) \cdot \left(1 - z\right) \end{array} \]
(FPCore (x y z) :precision binary64 (* (+ x y) (- 1.0 z)))
double code(double x, double y, double z) {
	return (x + y) * (1.0 - 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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + y) * (1.0d0 - z)
end function
public static double code(double x, double y, double z) {
	return (x + y) * (1.0 - z);
}
def code(x, y, z):
	return (x + y) * (1.0 - z)
function code(x, y, z)
	return Float64(Float64(x + y) * Float64(1.0 - z))
end
function tmp = code(x, y, z)
	tmp = (x + y) * (1.0 - z);
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 100.0% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \mathsf{fma}\left(-z, x + y, y\right) + x \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (+ (fma (- z) (+ x y) y) x))
assert(x < y && y < z);
double code(double x, double y, double z) {
	return fma(-z, (x + y), y) + x;
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	return Float64(fma(Float64(-z), Float64(x + y), y) + x)
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(N[((-z) * N[(x + y), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\mathsf{fma}\left(-z, x + y, y\right) + x
\end{array}
Derivation
  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 74.2% accurate, 0.4× speedup?

\[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;x + y \leq -1 \cdot 10^{-64}:\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{elif}\;x + y \leq 2 \cdot 10^{-283}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-y, z, y\right)\\ \end{array} \end{array} \]
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= (+ x y) -1e-64)
   (* x (- z))
   (if (<= (+ x y) 2e-283) (+ y x) (fma (- y) z y))))
assert(x < y && y < z);
double code(double x, double y, double z) {
	double tmp;
	if ((x + y) <= -1e-64) {
		tmp = x * -z;
	} else if ((x + y) <= 2e-283) {
		tmp = y + x;
	} else {
		tmp = fma(-y, z, y);
	}
	return tmp;
}
x, y, z = sort([x, y, z])
function code(x, y, z)
	tmp = 0.0
	if (Float64(x + y) <= -1e-64)
		tmp = Float64(x * Float64(-z));
	elseif (Float64(x + y) <= 2e-283)
		tmp = Float64(y + x);
	else
		tmp = fma(Float64(-y), z, y);
	end
	return tmp
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -1e-64], N[(x * (-z)), $MachinePrecision], If[LessEqual[N[(x + y), $MachinePrecision], 2e-283], N[(y + x), $MachinePrecision], N[((-y) * z + y), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;x + y \leq -1 \cdot 10^{-64}:\\
\;\;\;\;x \cdot \left(-z\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, z, y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 x y) < -9.99999999999999965e-65

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \color{blue}{1} \]
      3. Step-by-step derivation
        1. Applied rewrites22.8%

          \[\leadsto x \cdot \color{blue}{1} \]
        2. Taylor expanded in z around inf

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

            \[\leadsto x \cdot \left(\mathsf{neg}\left(z\right)\right) \]
          2. lift-neg.f6427.6

            \[\leadsto x \cdot \left(-z\right) \]
        4. Applied rewrites27.6%

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

        if -9.99999999999999965e-65 < (+.f64 x y) < 1.99999999999999989e-283

        1. Initial program 100.0%

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

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

            \[\leadsto y + \color{blue}{x} \]
          2. lower-+.f6456.8

            \[\leadsto y + \color{blue}{x} \]
        5. Applied rewrites56.8%

          \[\leadsto \color{blue}{y + x} \]

        if 1.99999999999999989e-283 < (+.f64 x y)

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto -1 \cdot \left(y \cdot z\right) + \color{blue}{y} \]
          2. mul-1-negN/A

            \[\leadsto \left(\mathsf{neg}\left(y \cdot z\right)\right) + y \]
          3. distribute-lft-neg-inN/A

            \[\leadsto \left(\mathsf{neg}\left(y\right)\right) \cdot z + y \]
          4. lower-fma.f64N/A

            \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(y\right), \color{blue}{z}, y\right) \]
          5. lower-neg.f6448.0

            \[\leadsto \mathsf{fma}\left(-y, z, y\right) \]
        9. Applied rewrites48.0%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;x + y \leq -1 \cdot 10^{-64}:\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{elif}\;x + y \leq 2 \cdot 10^{-283}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-y, z, y\right)\\ \end{array} \]
      6. Add Preprocessing

      Alternative 3: 75.0% accurate, 0.5× speedup?

      \[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;1 - z \leq -2000 \lor \neg \left(1 - z \leq 5000000000\right):\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \end{array} \]
      NOTE: x, y, and z should be sorted in increasing order before calling this function.
      (FPCore (x y z)
       :precision binary64
       (if (or (<= (- 1.0 z) -2000.0) (not (<= (- 1.0 z) 5000000000.0)))
         (* x (- z))
         (+ y x)))
      assert(x < y && y < z);
      double code(double x, double y, double z) {
      	double tmp;
      	if (((1.0 - z) <= -2000.0) || !((1.0 - z) <= 5000000000.0)) {
      		tmp = x * -z;
      	} else {
      		tmp = y + x;
      	}
      	return tmp;
      }
      
      NOTE: x, y, and z should be sorted in increasing order before calling this function.
      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)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8) :: tmp
          if (((1.0d0 - z) <= (-2000.0d0)) .or. (.not. ((1.0d0 - z) <= 5000000000.0d0))) then
              tmp = x * -z
          else
              tmp = y + x
          end if
          code = tmp
      end function
      
      assert x < y && y < z;
      public static double code(double x, double y, double z) {
      	double tmp;
      	if (((1.0 - z) <= -2000.0) || !((1.0 - z) <= 5000000000.0)) {
      		tmp = x * -z;
      	} else {
      		tmp = y + x;
      	}
      	return tmp;
      }
      
      [x, y, z] = sort([x, y, z])
      def code(x, y, z):
      	tmp = 0
      	if ((1.0 - z) <= -2000.0) or not ((1.0 - z) <= 5000000000.0):
      		tmp = x * -z
      	else:
      		tmp = y + x
      	return tmp
      
      x, y, z = sort([x, y, z])
      function code(x, y, z)
      	tmp = 0.0
      	if ((Float64(1.0 - z) <= -2000.0) || !(Float64(1.0 - z) <= 5000000000.0))
      		tmp = Float64(x * Float64(-z));
      	else
      		tmp = Float64(y + x);
      	end
      	return tmp
      end
      
      x, y, z = num2cell(sort([x, y, z])){:}
      function tmp_2 = code(x, y, z)
      	tmp = 0.0;
      	if (((1.0 - z) <= -2000.0) || ~(((1.0 - z) <= 5000000000.0)))
      		tmp = x * -z;
      	else
      		tmp = y + x;
      	end
      	tmp_2 = tmp;
      end
      
      NOTE: x, y, and z should be sorted in increasing order before calling this function.
      code[x_, y_, z_] := If[Or[LessEqual[N[(1.0 - z), $MachinePrecision], -2000.0], N[Not[LessEqual[N[(1.0 - z), $MachinePrecision], 5000000000.0]], $MachinePrecision]], N[(x * (-z)), $MachinePrecision], N[(y + x), $MachinePrecision]]
      
      \begin{array}{l}
      [x, y, z] = \mathsf{sort}([x, y, z])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;1 - z \leq -2000 \lor \neg \left(1 - z \leq 5000000000\right):\\
      \;\;\;\;x \cdot \left(-z\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;y + x\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (-.f64 #s(literal 1 binary64) z) < -2e3 or 5e9 < (-.f64 #s(literal 1 binary64) z)

        1. Initial program 100.0%

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

          \[\leadsto \color{blue}{x} \cdot \left(1 - z\right) \]
        4. Step-by-step derivation
          1. Applied rewrites51.2%

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

            \[\leadsto x \cdot \color{blue}{1} \]
          3. Step-by-step derivation
            1. Applied rewrites2.9%

              \[\leadsto x \cdot \color{blue}{1} \]
            2. Taylor expanded in z around inf

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

                \[\leadsto x \cdot \left(\mathsf{neg}\left(z\right)\right) \]
              2. lift-neg.f6450.8

                \[\leadsto x \cdot \left(-z\right) \]
            4. Applied rewrites50.8%

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

            if -2e3 < (-.f64 #s(literal 1 binary64) z) < 5e9

            1. Initial program 100.0%

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

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

                \[\leadsto y + \color{blue}{x} \]
              2. lower-+.f6494.8

                \[\leadsto y + \color{blue}{x} \]
            5. Applied rewrites94.8%

              \[\leadsto \color{blue}{y + x} \]
          4. Recombined 2 regimes into one program.
          5. Final simplification72.4%

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

          Alternative 4: 75.0% accurate, 0.5× speedup?

          \[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;1 - z \leq -2000:\\ \;\;\;\;x \cdot \left(-z\right)\\ \mathbf{elif}\;1 - z \leq 2:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \end{array} \end{array} \]
          NOTE: x, y, and z should be sorted in increasing order before calling this function.
          (FPCore (x y z)
           :precision binary64
           (if (<= (- 1.0 z) -2000.0)
             (* x (- z))
             (if (<= (- 1.0 z) 2.0) (+ y x) (* y (- z)))))
          assert(x < y && y < z);
          double code(double x, double y, double z) {
          	double tmp;
          	if ((1.0 - z) <= -2000.0) {
          		tmp = x * -z;
          	} else if ((1.0 - z) <= 2.0) {
          		tmp = y + x;
          	} else {
          		tmp = y * -z;
          	}
          	return tmp;
          }
          
          NOTE: x, y, and z should be sorted in increasing order before calling this function.
          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)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8) :: tmp
              if ((1.0d0 - z) <= (-2000.0d0)) then
                  tmp = x * -z
              else if ((1.0d0 - z) <= 2.0d0) then
                  tmp = y + x
              else
                  tmp = y * -z
              end if
              code = tmp
          end function
          
          assert x < y && y < z;
          public static double code(double x, double y, double z) {
          	double tmp;
          	if ((1.0 - z) <= -2000.0) {
          		tmp = x * -z;
          	} else if ((1.0 - z) <= 2.0) {
          		tmp = y + x;
          	} else {
          		tmp = y * -z;
          	}
          	return tmp;
          }
          
          [x, y, z] = sort([x, y, z])
          def code(x, y, z):
          	tmp = 0
          	if (1.0 - z) <= -2000.0:
          		tmp = x * -z
          	elif (1.0 - z) <= 2.0:
          		tmp = y + x
          	else:
          		tmp = y * -z
          	return tmp
          
          x, y, z = sort([x, y, z])
          function code(x, y, z)
          	tmp = 0.0
          	if (Float64(1.0 - z) <= -2000.0)
          		tmp = Float64(x * Float64(-z));
          	elseif (Float64(1.0 - z) <= 2.0)
          		tmp = Float64(y + x);
          	else
          		tmp = Float64(y * Float64(-z));
          	end
          	return tmp
          end
          
          x, y, z = num2cell(sort([x, y, z])){:}
          function tmp_2 = code(x, y, z)
          	tmp = 0.0;
          	if ((1.0 - z) <= -2000.0)
          		tmp = x * -z;
          	elseif ((1.0 - z) <= 2.0)
          		tmp = y + x;
          	else
          		tmp = y * -z;
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: x, y, and z should be sorted in increasing order before calling this function.
          code[x_, y_, z_] := If[LessEqual[N[(1.0 - z), $MachinePrecision], -2000.0], N[(x * (-z)), $MachinePrecision], If[LessEqual[N[(1.0 - z), $MachinePrecision], 2.0], N[(y + x), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]]
          
          \begin{array}{l}
          [x, y, z] = \mathsf{sort}([x, y, z])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;1 - z \leq -2000:\\
          \;\;\;\;x \cdot \left(-z\right)\\
          
          \mathbf{elif}\;1 - z \leq 2:\\
          \;\;\;\;y + x\\
          
          \mathbf{else}:\\
          \;\;\;\;y \cdot \left(-z\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if (-.f64 #s(literal 1 binary64) z) < -2e3

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{x} \cdot \left(1 - z\right) \]
            4. Step-by-step derivation
              1. Applied rewrites46.6%

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

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

                  \[\leadsto x \cdot \color{blue}{1} \]
                2. Taylor expanded in z around inf

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

                    \[\leadsto x \cdot \left(\mathsf{neg}\left(z\right)\right) \]
                  2. lift-neg.f6445.7

                    \[\leadsto x \cdot \left(-z\right) \]
                4. Applied rewrites45.7%

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

                if -2e3 < (-.f64 #s(literal 1 binary64) z) < 2

                1. Initial program 100.0%

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

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

                    \[\leadsto y + \color{blue}{x} \]
                  2. lower-+.f6497.5

                    \[\leadsto y + \color{blue}{x} \]
                5. Applied rewrites97.5%

                  \[\leadsto \color{blue}{y + x} \]

                if 2 < (-.f64 #s(literal 1 binary64) z)

                1. Initial program 100.0%

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

                  \[\leadsto \color{blue}{y} \cdot \left(1 - z\right) \]
                4. Step-by-step derivation
                  1. Applied rewrites44.1%

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

                    \[\leadsto y \cdot \color{blue}{1} \]
                  3. Step-by-step derivation
                    1. Applied rewrites4.3%

                      \[\leadsto y \cdot \color{blue}{1} \]
                    2. Taylor expanded in z around inf

                      \[\leadsto y \cdot \color{blue}{\left(-1 \cdot z\right)} \]
                    3. Step-by-step derivation
                      1. mul-1-negN/A

                        \[\leadsto y \cdot \left(\mathsf{neg}\left(z\right)\right) \]
                      2. lift-neg.f6443.9

                        \[\leadsto y \cdot \left(-z\right) \]
                    4. Applied rewrites43.9%

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

                  Alternative 5: 98.1% accurate, 0.7× speedup?

                  \[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;x + y \leq -4 \cdot 10^{-300}:\\ \;\;\;\;\mathsf{fma}\left(-z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-y, z, y\right)\\ \end{array} \end{array} \]
                  NOTE: x, y, and z should be sorted in increasing order before calling this function.
                  (FPCore (x y z)
                   :precision binary64
                   (if (<= (+ x y) -4e-300) (fma (- z) x x) (fma (- y) z y)))
                  assert(x < y && y < z);
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if ((x + y) <= -4e-300) {
                  		tmp = fma(-z, x, x);
                  	} else {
                  		tmp = fma(-y, z, y);
                  	}
                  	return tmp;
                  }
                  
                  x, y, z = sort([x, y, z])
                  function code(x, y, z)
                  	tmp = 0.0
                  	if (Float64(x + y) <= -4e-300)
                  		tmp = fma(Float64(-z), x, x);
                  	else
                  		tmp = fma(Float64(-y), z, y);
                  	end
                  	return tmp
                  end
                  
                  NOTE: x, y, and z should be sorted in increasing order before calling this function.
                  code[x_, y_, z_] := If[LessEqual[N[(x + y), $MachinePrecision], -4e-300], N[((-z) * x + x), $MachinePrecision], N[((-y) * z + y), $MachinePrecision]]
                  
                  \begin{array}{l}
                  [x, y, z] = \mathsf{sort}([x, y, z])\\
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;x + y \leq -4 \cdot 10^{-300}:\\
                  \;\;\;\;\mathsf{fma}\left(-z, x, x\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\mathsf{fma}\left(-y, z, y\right)\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if (+.f64 x y) < -4.0000000000000001e-300

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left(\mathsf{neg}\left(z \cdot x\right)\right) + x \]
                      4. distribute-lft-neg-inN/A

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

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

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

                        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(z\right), x, x\right) \]
                      8. lift-neg.f6448.5

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

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

                    if -4.0000000000000001e-300 < (+.f64 x y)

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto -1 \cdot \left(y \cdot z\right) + \color{blue}{y} \]
                      2. mul-1-negN/A

                        \[\leadsto \left(\mathsf{neg}\left(y \cdot z\right)\right) + y \]
                      3. distribute-lft-neg-inN/A

                        \[\leadsto \left(\mathsf{neg}\left(y\right)\right) \cdot z + y \]
                      4. lower-fma.f64N/A

                        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(y\right), \color{blue}{z}, y\right) \]
                      5. lower-neg.f6448.0

                        \[\leadsto \mathsf{fma}\left(-y, z, y\right) \]
                    9. Applied rewrites48.0%

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

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

                  Alternative 6: 49.6% accurate, 0.7× speedup?

                  \[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \begin{array}{l} \mathbf{if}\;\left(x + y\right) \cdot \left(1 - z\right) \leq -5 \cdot 10^{-227}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
                  NOTE: x, y, and z should be sorted in increasing order before calling this function.
                  (FPCore (x y z)
                   :precision binary64
                   (if (<= (* (+ x y) (- 1.0 z)) -5e-227) x y))
                  assert(x < y && y < z);
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if (((x + y) * (1.0 - z)) <= -5e-227) {
                  		tmp = x;
                  	} else {
                  		tmp = y;
                  	}
                  	return tmp;
                  }
                  
                  NOTE: x, y, and z should be sorted in increasing order before calling this function.
                  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)
                  use fmin_fmax_functions
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8), intent (in) :: z
                      real(8) :: tmp
                      if (((x + y) * (1.0d0 - z)) <= (-5d-227)) then
                          tmp = x
                      else
                          tmp = y
                      end if
                      code = tmp
                  end function
                  
                  assert x < y && y < z;
                  public static double code(double x, double y, double z) {
                  	double tmp;
                  	if (((x + y) * (1.0 - z)) <= -5e-227) {
                  		tmp = x;
                  	} else {
                  		tmp = y;
                  	}
                  	return tmp;
                  }
                  
                  [x, y, z] = sort([x, y, z])
                  def code(x, y, z):
                  	tmp = 0
                  	if ((x + y) * (1.0 - z)) <= -5e-227:
                  		tmp = x
                  	else:
                  		tmp = y
                  	return tmp
                  
                  x, y, z = sort([x, y, z])
                  function code(x, y, z)
                  	tmp = 0.0
                  	if (Float64(Float64(x + y) * Float64(1.0 - z)) <= -5e-227)
                  		tmp = x;
                  	else
                  		tmp = y;
                  	end
                  	return tmp
                  end
                  
                  x, y, z = num2cell(sort([x, y, z])){:}
                  function tmp_2 = code(x, y, z)
                  	tmp = 0.0;
                  	if (((x + y) * (1.0 - z)) <= -5e-227)
                  		tmp = x;
                  	else
                  		tmp = y;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  NOTE: x, y, and z should be sorted in increasing order before calling this function.
                  code[x_, y_, z_] := If[LessEqual[N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], -5e-227], x, y]
                  
                  \begin{array}{l}
                  [x, y, z] = \mathsf{sort}([x, y, z])\\
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;\left(x + y\right) \cdot \left(1 - z\right) \leq -5 \cdot 10^{-227}:\\
                  \;\;\;\;x\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;y\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if (*.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) z)) < -4.99999999999999961e-227

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left(\mathsf{neg}\left(z \cdot x\right)\right) + x \]
                      4. distribute-lft-neg-inN/A

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

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

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

                        \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(z\right), x, x\right) \]
                      8. lift-neg.f6448.0

                        \[\leadsto \mathsf{fma}\left(-z, x, x\right) \]
                    9. Applied rewrites48.0%

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

                      \[\leadsto x \]
                    11. Step-by-step derivation
                      1. Applied rewrites24.5%

                        \[\leadsto x \]

                      if -4.99999999999999961e-227 < (*.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) z))

                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto -1 \cdot \left(y \cdot z\right) + \color{blue}{y} \]
                        2. mul-1-negN/A

                          \[\leadsto \left(\mathsf{neg}\left(y \cdot z\right)\right) + y \]
                        3. distribute-lft-neg-inN/A

                          \[\leadsto \left(\mathsf{neg}\left(y\right)\right) \cdot z + y \]
                        4. lower-fma.f64N/A

                          \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(y\right), \color{blue}{z}, y\right) \]
                        5. lower-neg.f6447.9

                          \[\leadsto \mathsf{fma}\left(-y, z, y\right) \]
                      9. Applied rewrites47.9%

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

                        \[\leadsto y \]
                      11. Step-by-step derivation
                        1. Applied rewrites24.2%

                          \[\leadsto y \]
                      12. Recombined 2 regimes into one program.
                      13. Final simplification24.3%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x + y\right) \cdot \left(1 - z\right) \leq -5 \cdot 10^{-227}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
                      14. Add Preprocessing

                      Alternative 7: 100.0% accurate, 1.0× speedup?

                      \[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ \left(x + y\right) \cdot \left(1 - z\right) \end{array} \]
                      NOTE: x, y, and z should be sorted in increasing order before calling this function.
                      (FPCore (x y z) :precision binary64 (* (+ x y) (- 1.0 z)))
                      assert(x < y && y < z);
                      double code(double x, double y, double z) {
                      	return (x + y) * (1.0 - z);
                      }
                      
                      NOTE: x, y, and z should be sorted in increasing order before calling this function.
                      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)
                      use fmin_fmax_functions
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8), intent (in) :: z
                          code = (x + y) * (1.0d0 - z)
                      end function
                      
                      assert x < y && y < z;
                      public static double code(double x, double y, double z) {
                      	return (x + y) * (1.0 - z);
                      }
                      
                      [x, y, z] = sort([x, y, z])
                      def code(x, y, z):
                      	return (x + y) * (1.0 - z)
                      
                      x, y, z = sort([x, y, z])
                      function code(x, y, z)
                      	return Float64(Float64(x + y) * Float64(1.0 - z))
                      end
                      
                      x, y, z = num2cell(sort([x, y, z])){:}
                      function tmp = code(x, y, z)
                      	tmp = (x + y) * (1.0 - z);
                      end
                      
                      NOTE: x, y, and z should be sorted in increasing order before calling this function.
                      code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]
                      
                      \begin{array}{l}
                      [x, y, z] = \mathsf{sort}([x, y, z])\\
                      \\
                      \left(x + y\right) \cdot \left(1 - z\right)
                      \end{array}
                      
                      Derivation
                      1. Initial program 100.0%

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

                      Alternative 8: 50.5% accurate, 3.0× speedup?

                      \[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ y + x \end{array} \]
                      NOTE: x, y, and z should be sorted in increasing order before calling this function.
                      (FPCore (x y z) :precision binary64 (+ y x))
                      assert(x < y && y < z);
                      double code(double x, double y, double z) {
                      	return y + x;
                      }
                      
                      NOTE: x, y, and z should be sorted in increasing order before calling this function.
                      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)
                      use fmin_fmax_functions
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8), intent (in) :: z
                          code = y + x
                      end function
                      
                      assert x < y && y < z;
                      public static double code(double x, double y, double z) {
                      	return y + x;
                      }
                      
                      [x, y, z] = sort([x, y, z])
                      def code(x, y, z):
                      	return y + x
                      
                      x, y, z = sort([x, y, z])
                      function code(x, y, z)
                      	return Float64(y + x)
                      end
                      
                      x, y, z = num2cell(sort([x, y, z])){:}
                      function tmp = code(x, y, z)
                      	tmp = y + x;
                      end
                      
                      NOTE: x, y, and z should be sorted in increasing order before calling this function.
                      code[x_, y_, z_] := N[(y + x), $MachinePrecision]
                      
                      \begin{array}{l}
                      [x, y, z] = \mathsf{sort}([x, y, z])\\
                      \\
                      y + x
                      \end{array}
                      
                      Derivation
                      1. Initial program 100.0%

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

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

                          \[\leadsto y + \color{blue}{x} \]
                        2. lower-+.f6448.5

                          \[\leadsto y + \color{blue}{x} \]
                      5. Applied rewrites48.5%

                        \[\leadsto \color{blue}{y + x} \]
                      6. Add Preprocessing

                      Alternative 9: 26.4% accurate, 12.0× speedup?

                      \[\begin{array}{l} [x, y, z] = \mathsf{sort}([x, y, z])\\ \\ y \end{array} \]
                      NOTE: x, y, and z should be sorted in increasing order before calling this function.
                      (FPCore (x y z) :precision binary64 y)
                      assert(x < y && y < z);
                      double code(double x, double y, double z) {
                      	return y;
                      }
                      
                      NOTE: x, y, and z should be sorted in increasing order before calling this function.
                      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)
                      use fmin_fmax_functions
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8), intent (in) :: z
                          code = y
                      end function
                      
                      assert x < y && y < z;
                      public static double code(double x, double y, double z) {
                      	return y;
                      }
                      
                      [x, y, z] = sort([x, y, z])
                      def code(x, y, z):
                      	return y
                      
                      x, y, z = sort([x, y, z])
                      function code(x, y, z)
                      	return y
                      end
                      
                      x, y, z = num2cell(sort([x, y, z])){:}
                      function tmp = code(x, y, z)
                      	tmp = y;
                      end
                      
                      NOTE: x, y, and z should be sorted in increasing order before calling this function.
                      code[x_, y_, z_] := y
                      
                      \begin{array}{l}
                      [x, y, z] = \mathsf{sort}([x, y, z])\\
                      \\
                      y
                      \end{array}
                      
                      Derivation
                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto -1 \cdot \left(y \cdot z\right) + \color{blue}{y} \]
                        2. mul-1-negN/A

                          \[\leadsto \left(\mathsf{neg}\left(y \cdot z\right)\right) + y \]
                        3. distribute-lft-neg-inN/A

                          \[\leadsto \left(\mathsf{neg}\left(y\right)\right) \cdot z + y \]
                        4. lower-fma.f64N/A

                          \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(y\right), \color{blue}{z}, y\right) \]
                        5. lower-neg.f6449.9

                          \[\leadsto \mathsf{fma}\left(-y, z, y\right) \]
                      9. Applied rewrites49.9%

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

                        \[\leadsto y \]
                      11. Step-by-step derivation
                        1. Applied rewrites25.6%

                          \[\leadsto y \]
                        2. Final simplification25.6%

                          \[\leadsto y \]
                        3. Add Preprocessing

                        Reproduce

                        ?
                        herbie shell --seed 2025080 
                        (FPCore (x y z)
                          :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, H"
                          :precision binary64
                          (* (+ x y) (- 1.0 z)))