Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D

Percentage Accurate: 99.5% → 99.8%
Time: 3.7s
Alternatives: 11
Speedup: 1.4×

Specification

?
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
(FPCore (x y z)
 :precision binary64
 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.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 - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z)))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 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: 99.5% accurate, 1.0× speedup?

\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
(FPCore (x y z)
 :precision binary64
 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.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 - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z)))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \frac{2}{3} + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + x \]
    7. associate-+l+N/A

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

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

      \[\leadsto \color{blue}{\left(6 \cdot \left(y - x\right)\right)} \cdot \frac{2}{3} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
    10. associate-*l*N/A

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

      \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot \frac{2}{3}\right) \cdot 6} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
    12. associate-*r*N/A

      \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right)} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
    13. add-flip-revN/A

      \[\leadsto \left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right) + \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
    14. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \frac{2}{3} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
    15. lift-/.f64N/A

      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
    16. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
    17. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4}, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
    18. add-flip-revN/A

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

      \[\leadsto \mathsf{fma}\left(y - x, 4, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\left(y - x\right) \cdot 6\right)} + x\right) \]
  3. Applied rewrites99.8%

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

Alternative 2: 99.8% accurate, 1.4× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \color{blue}{\left(y - x\right)} + x \]
    10. sub-negate-revN/A

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

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \left(x - y\right)\right)\right)} + x \]
    12. distribute-lft-neg-inN/A

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

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

      \[\leadsto \left(6 \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\frac{2}{3} - z\right)}\right)\right)\right) \cdot \left(x - y\right) + x \]
    15. sub-negate-revN/A

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(6 \cdot \left(z - \frac{2}{3}\right), x - y, x\right)} \]
  3. Applied rewrites99.8%

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

Alternative 3: 97.2% accurate, 0.9× speedup?

\[\begin{array}{l} \mathbf{if}\;z \leq -10500000:\\ \;\;\;\;x + \left(-6 \cdot \left(y - x\right)\right) \cdot z\\ \mathbf{elif}\;z \leq 9500000:\\ \;\;\;\;\mathsf{fma}\left(-4, x - y, x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot \left(-6 \cdot z\right)\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -10500000.0)
   (+ x (* (* -6.0 (- y x)) z))
   (if (<= z 9500000.0) (fma -4.0 (- x y) x) (+ x (* (- y x) (* -6.0 z))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -10500000.0) {
		tmp = x + ((-6.0 * (y - x)) * z);
	} else if (z <= 9500000.0) {
		tmp = fma(-4.0, (x - y), x);
	} else {
		tmp = x + ((y - x) * (-6.0 * z));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (z <= -10500000.0)
		tmp = Float64(x + Float64(Float64(-6.0 * Float64(y - x)) * z));
	elseif (z <= 9500000.0)
		tmp = fma(-4.0, Float64(x - y), x);
	else
		tmp = Float64(x + Float64(Float64(y - x) * Float64(-6.0 * z)));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[z, -10500000.0], N[(x + N[(N[(-6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9500000.0], N[(-4.0 * N[(x - y), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -10500000:\\
\;\;\;\;x + \left(-6 \cdot \left(y - x\right)\right) \cdot z\\

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

\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right) \cdot \left(-6 \cdot z\right)\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.05e7

    1. Initial program 99.5%

      \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
    2. Taylor expanded in z around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \left(6 \cdot \left(x - y\right)\right) \cdot z \]
      10. lift--.f64N/A

        \[\leadsto x + \left(6 \cdot \left(x - y\right)\right) \cdot z \]
      11. lower-*.f64N/A

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

        \[\leadsto x + \left(6 \cdot \left(x - y\right)\right) \cdot z \]
      13. sub-negate-revN/A

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

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

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

        \[\leadsto x + \left(\left(\mathsf{neg}\left(6\right)\right) \cdot \left(y - x\right)\right) \cdot z \]
      17. metadata-evalN/A

        \[\leadsto x + \left(-6 \cdot \left(y - x\right)\right) \cdot z \]
      18. lower-*.f6450.6%

        \[\leadsto x + \left(-6 \cdot \left(y - x\right)\right) \cdot z \]
    6. Applied rewrites50.6%

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

    if -1.05e7 < z < 9.5e6

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \color{blue}{\left(y - x\right)} + x \]
      10. sub-negate-revN/A

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

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \left(x - y\right)\right)\right)} + x \]
      12. distribute-lft-neg-inN/A

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

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

        \[\leadsto \left(6 \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\frac{2}{3} - z\right)}\right)\right)\right) \cdot \left(x - y\right) + x \]
      15. sub-negate-revN/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(6 \cdot \left(z - \frac{2}{3}\right), x - y, x\right)} \]
    3. Applied rewrites99.8%

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

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

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

      if 9.5e6 < z

      1. Initial program 99.5%

        \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
      2. Taylor expanded in z around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x + \left(6 \cdot \left(x - y\right)\right) \cdot z \]
        10. lift--.f64N/A

          \[\leadsto x + \left(6 \cdot \left(x - y\right)\right) \cdot z \]
        11. lower-*.f64N/A

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

          \[\leadsto x + \left(6 \cdot \left(x - y\right)\right) \cdot z \]
        13. sub-negate-revN/A

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

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

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

          \[\leadsto x + \left(\left(\mathsf{neg}\left(6\right)\right) \cdot \left(y - x\right)\right) \cdot z \]
        17. metadata-evalN/A

          \[\leadsto x + \left(-6 \cdot \left(y - x\right)\right) \cdot z \]
        18. lower-*.f6450.6%

          \[\leadsto x + \left(-6 \cdot \left(y - x\right)\right) \cdot z \]
      6. Applied rewrites50.6%

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

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

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

          \[\leadsto x + \left(\left(y - x\right) \cdot -6\right) \cdot z \]
        4. associate-*l*N/A

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

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

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

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

    Alternative 4: 97.2% accurate, 0.9× speedup?

    \[\begin{array}{l} t_0 := x + \left(-6 \cdot \left(y - x\right)\right) \cdot z\\ \mathbf{if}\;z \leq -10500000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 9500000:\\ \;\;\;\;\mathsf{fma}\left(-4, x - y, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (+ x (* (* -6.0 (- y x)) z))))
       (if (<= z -10500000.0) t_0 (if (<= z 9500000.0) (fma -4.0 (- x y) x) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = x + ((-6.0 * (y - x)) * z);
    	double tmp;
    	if (z <= -10500000.0) {
    		tmp = t_0;
    	} else if (z <= 9500000.0) {
    		tmp = fma(-4.0, (x - y), x);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = Float64(x + Float64(Float64(-6.0 * Float64(y - x)) * z))
    	tmp = 0.0
    	if (z <= -10500000.0)
    		tmp = t_0;
    	elseif (z <= 9500000.0)
    		tmp = fma(-4.0, Float64(x - y), x);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(N[(-6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -10500000.0], t$95$0, If[LessEqual[z, 9500000.0], N[(-4.0 * N[(x - y), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    t_0 := x + \left(-6 \cdot \left(y - x\right)\right) \cdot z\\
    \mathbf{if}\;z \leq -10500000:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;z \leq 9500000:\\
    \;\;\;\;\mathsf{fma}\left(-4, x - y, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -1.05e7 or 9.5e6 < z

      1. Initial program 99.5%

        \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
      2. Taylor expanded in z around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto x + \left(6 \cdot \left(x - y\right)\right) \cdot z \]
        10. lift--.f64N/A

          \[\leadsto x + \left(6 \cdot \left(x - y\right)\right) \cdot z \]
        11. lower-*.f64N/A

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

          \[\leadsto x + \left(6 \cdot \left(x - y\right)\right) \cdot z \]
        13. sub-negate-revN/A

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

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

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

          \[\leadsto x + \left(\left(\mathsf{neg}\left(6\right)\right) \cdot \left(y - x\right)\right) \cdot z \]
        17. metadata-evalN/A

          \[\leadsto x + \left(-6 \cdot \left(y - x\right)\right) \cdot z \]
        18. lower-*.f6450.6%

          \[\leadsto x + \left(-6 \cdot \left(y - x\right)\right) \cdot z \]
      6. Applied rewrites50.6%

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

      if -1.05e7 < z < 9.5e6

      1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \color{blue}{\left(y - x\right)} + x \]
        10. sub-negate-revN/A

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

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \left(x - y\right)\right)\right)} + x \]
        12. distribute-lft-neg-inN/A

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

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

          \[\leadsto \left(6 \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\frac{2}{3} - z\right)}\right)\right)\right) \cdot \left(x - y\right) + x \]
        15. sub-negate-revN/A

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(6 \cdot \left(z - \frac{2}{3}\right), x - y, x\right)} \]
      3. Applied rewrites99.8%

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

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

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

      Alternative 5: 97.2% accurate, 1.1× speedup?

      \[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot \left(x - y\right)\right)\\ \mathbf{if}\;z \leq -10500000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 9500000:\\ \;\;\;\;\mathsf{fma}\left(-4, x - y, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (* 6.0 (* z (- x y)))))
         (if (<= z -10500000.0) t_0 (if (<= z 9500000.0) (fma -4.0 (- x y) x) t_0))))
      double code(double x, double y, double z) {
      	double t_0 = 6.0 * (z * (x - y));
      	double tmp;
      	if (z <= -10500000.0) {
      		tmp = t_0;
      	} else if (z <= 9500000.0) {
      		tmp = fma(-4.0, (x - y), x);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = Float64(6.0 * Float64(z * Float64(x - y)))
      	tmp = 0.0
      	if (z <= -10500000.0)
      		tmp = t_0;
      	elseif (z <= 9500000.0)
      		tmp = fma(-4.0, Float64(x - y), x);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(z * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -10500000.0], t$95$0, If[LessEqual[z, 9500000.0], N[(-4.0 * N[(x - y), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      t_0 := 6 \cdot \left(z \cdot \left(x - y\right)\right)\\
      \mathbf{if}\;z \leq -10500000:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;z \leq 9500000:\\
      \;\;\;\;\mathsf{fma}\left(-4, x - y, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < -1.05e7 or 9.5e6 < z

        1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \color{blue}{\left(y - x\right)} + x \]
          10. sub-negate-revN/A

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

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \left(x - y\right)\right)\right)} + x \]
          12. distribute-lft-neg-inN/A

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

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

            \[\leadsto \left(6 \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\frac{2}{3} - z\right)}\right)\right)\right) \cdot \left(x - y\right) + x \]
          15. sub-negate-revN/A

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(6 \cdot \left(z - \frac{2}{3}\right), x - y, x\right)} \]
        3. Applied rewrites99.8%

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

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{z \cdot 6} + -4, x - y, x\right) \]
          3. add-flipN/A

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

            \[\leadsto \mathsf{fma}\left(z \cdot 6 - \color{blue}{4}, x - y, x\right) \]
          5. sub-to-multN/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(1 - \frac{4}{z \cdot 6}\right) \cdot \left(z \cdot 6\right)}, x - y, x\right) \]
          6. lower-unsound-*.f64N/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(1 - \frac{4}{z \cdot 6}\right) \cdot \left(z \cdot 6\right)}, x - y, x\right) \]
          7. lower-unsound--.f64N/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(1 - \frac{4}{z \cdot 6}\right)} \cdot \left(z \cdot 6\right), x - y, x\right) \]
          8. lower-unsound-/.f6499.7%

            \[\leadsto \mathsf{fma}\left(\left(1 - \color{blue}{\frac{4}{z \cdot 6}}\right) \cdot \left(z \cdot 6\right), x - y, x\right) \]
          9. lift-*.f64N/A

            \[\leadsto \mathsf{fma}\left(\left(1 - \frac{4}{\color{blue}{z \cdot 6}}\right) \cdot \left(z \cdot 6\right), x - y, x\right) \]
          10. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(\left(1 - \frac{4}{\color{blue}{6 \cdot z}}\right) \cdot \left(z \cdot 6\right), x - y, x\right) \]
          11. lower-*.f6499.7%

            \[\leadsto \mathsf{fma}\left(\left(1 - \frac{4}{\color{blue}{6 \cdot z}}\right) \cdot \left(z \cdot 6\right), x - y, x\right) \]
          12. lift-*.f64N/A

            \[\leadsto \mathsf{fma}\left(\left(1 - \frac{4}{6 \cdot z}\right) \cdot \color{blue}{\left(z \cdot 6\right)}, x - y, x\right) \]
          13. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(\left(1 - \frac{4}{6 \cdot z}\right) \cdot \color{blue}{\left(6 \cdot z\right)}, x - y, x\right) \]
          14. lower-*.f6499.7%

            \[\leadsto \mathsf{fma}\left(\left(1 - \frac{4}{6 \cdot z}\right) \cdot \color{blue}{\left(6 \cdot z\right)}, x - y, x\right) \]
        5. Applied rewrites99.7%

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

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

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

            \[\leadsto 6 \cdot \left(z \cdot \color{blue}{\left(x - y\right)}\right) \]
          3. lower--.f6451.1%

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

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

        if -1.05e7 < z < 9.5e6

        1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \color{blue}{\left(y - x\right)} + x \]
          10. sub-negate-revN/A

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

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \left(x - y\right)\right)\right)} + x \]
          12. distribute-lft-neg-inN/A

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

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

            \[\leadsto \left(6 \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\frac{2}{3} - z\right)}\right)\right)\right) \cdot \left(x - y\right) + x \]
          15. sub-negate-revN/A

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(6 \cdot \left(z - \frac{2}{3}\right), x - y, x\right)} \]
        3. Applied rewrites99.8%

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

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

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

        Alternative 6: 73.6% accurate, 1.1× speedup?

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

          1. Initial program 99.5%

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

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

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

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

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

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

              \[\leadsto \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \frac{2}{3} + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + x \]
            7. associate-+l+N/A

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

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

              \[\leadsto \color{blue}{\left(6 \cdot \left(y - x\right)\right)} \cdot \frac{2}{3} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
            10. associate-*l*N/A

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

              \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot \frac{2}{3}\right) \cdot 6} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
            12. associate-*r*N/A

              \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right)} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
            13. add-flip-revN/A

              \[\leadsto \left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right) + \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
            14. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \frac{2}{3} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
            15. lift-/.f64N/A

              \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
            16. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
            17. metadata-evalN/A

              \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4}, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
            18. add-flip-revN/A

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

              \[\leadsto \mathsf{fma}\left(y - x, 4, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\left(y - x\right) \cdot 6\right)} + x\right) \]
          3. Applied rewrites99.8%

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

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

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

              \[\leadsto y \cdot \left(4 + \color{blue}{-6 \cdot z}\right) \]
            3. lower-*.f6451.3%

              \[\leadsto y \cdot \left(4 + -6 \cdot \color{blue}{z}\right) \]
          6. Applied rewrites51.3%

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

            \[\leadsto y \cdot 4 \]
          8. Step-by-step derivation
            1. Applied rewrites25.8%

              \[\leadsto y \cdot 4 \]
            2. Taylor expanded in z around inf

              \[\leadsto y \cdot \left(-6 \cdot \color{blue}{z}\right) \]
            3. Step-by-step derivation
              1. lower-*.f6427.5%

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

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

            if -3.3000000000000001e25 < z < 9.5e6

            1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \color{blue}{\left(y - x\right)} + x \]
              10. sub-negate-revN/A

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

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \left(x - y\right)\right)\right)} + x \]
              12. distribute-lft-neg-inN/A

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

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

                \[\leadsto \left(6 \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\frac{2}{3} - z\right)}\right)\right)\right) \cdot \left(x - y\right) + x \]
              15. sub-negate-revN/A

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(6 \cdot \left(z - \frac{2}{3}\right), x - y, x\right)} \]
            3. Applied rewrites99.8%

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

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

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

              if 9.5e6 < z

              1. Initial program 99.5%

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \frac{2}{3} + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + x \]
                7. associate-+l+N/A

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

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

                  \[\leadsto \color{blue}{\left(6 \cdot \left(y - x\right)\right)} \cdot \frac{2}{3} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                10. associate-*l*N/A

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

                  \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot \frac{2}{3}\right) \cdot 6} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                12. associate-*r*N/A

                  \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right)} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                13. add-flip-revN/A

                  \[\leadsto \left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right) + \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                14. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \frac{2}{3} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                15. lift-/.f64N/A

                  \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                16. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                17. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4}, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                18. add-flip-revN/A

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

                  \[\leadsto \mathsf{fma}\left(y - x, 4, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\left(y - x\right) \cdot 6\right)} + x\right) \]
              3. Applied rewrites99.8%

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

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

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

                  \[\leadsto y \cdot \left(4 + \color{blue}{-6 \cdot z}\right) \]
                3. lower-*.f6451.3%

                  \[\leadsto y \cdot \left(4 + -6 \cdot \color{blue}{z}\right) \]
              6. Applied rewrites51.3%

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

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

                  \[\leadsto \left(4 + -6 \cdot z\right) \cdot \color{blue}{y} \]
                3. lower-*.f6451.3%

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

                  \[\leadsto \left(4 + -6 \cdot z\right) \cdot y \]
                5. +-commutativeN/A

                  \[\leadsto \left(-6 \cdot z + 4\right) \cdot y \]
                6. lift-*.f64N/A

                  \[\leadsto \left(-6 \cdot z + 4\right) \cdot y \]
                7. lower-fma.f6451.3%

                  \[\leadsto \mathsf{fma}\left(-6, z, 4\right) \cdot y \]
              8. Applied rewrites51.3%

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

            Alternative 7: 73.6% accurate, 1.1× speedup?

            \[\begin{array}{l} t_0 := y \cdot \left(-6 \cdot z\right)\\ \mathbf{if}\;z \leq -3.3 \cdot 10^{+25}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 9500000:\\ \;\;\;\;\mathsf{fma}\left(-4, x - y, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (* y (* -6.0 z))))
               (if (<= z -3.3e+25) t_0 (if (<= z 9500000.0) (fma -4.0 (- x y) x) t_0))))
            double code(double x, double y, double z) {
            	double t_0 = y * (-6.0 * z);
            	double tmp;
            	if (z <= -3.3e+25) {
            		tmp = t_0;
            	} else if (z <= 9500000.0) {
            		tmp = fma(-4.0, (x - y), x);
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	t_0 = Float64(y * Float64(-6.0 * z))
            	tmp = 0.0
            	if (z <= -3.3e+25)
            		tmp = t_0;
            	elseif (z <= 9500000.0)
            		tmp = fma(-4.0, Float64(x - y), x);
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+25], t$95$0, If[LessEqual[z, 9500000.0], N[(-4.0 * N[(x - y), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            t_0 := y \cdot \left(-6 \cdot z\right)\\
            \mathbf{if}\;z \leq -3.3 \cdot 10^{+25}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;z \leq 9500000:\\
            \;\;\;\;\mathsf{fma}\left(-4, x - y, x\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z < -3.3000000000000001e25 or 9.5e6 < z

              1. Initial program 99.5%

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \frac{2}{3} + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + x \]
                7. associate-+l+N/A

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

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

                  \[\leadsto \color{blue}{\left(6 \cdot \left(y - x\right)\right)} \cdot \frac{2}{3} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                10. associate-*l*N/A

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

                  \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot \frac{2}{3}\right) \cdot 6} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                12. associate-*r*N/A

                  \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right)} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                13. add-flip-revN/A

                  \[\leadsto \left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right) + \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                14. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \frac{2}{3} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                15. lift-/.f64N/A

                  \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                16. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                17. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4}, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                18. add-flip-revN/A

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

                  \[\leadsto \mathsf{fma}\left(y - x, 4, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\left(y - x\right) \cdot 6\right)} + x\right) \]
              3. Applied rewrites99.8%

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

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

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

                  \[\leadsto y \cdot \left(4 + \color{blue}{-6 \cdot z}\right) \]
                3. lower-*.f6451.3%

                  \[\leadsto y \cdot \left(4 + -6 \cdot \color{blue}{z}\right) \]
              6. Applied rewrites51.3%

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

                \[\leadsto y \cdot 4 \]
              8. Step-by-step derivation
                1. Applied rewrites25.8%

                  \[\leadsto y \cdot 4 \]
                2. Taylor expanded in z around inf

                  \[\leadsto y \cdot \left(-6 \cdot \color{blue}{z}\right) \]
                3. Step-by-step derivation
                  1. lower-*.f6427.5%

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

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

                if -3.3000000000000001e25 < z < 9.5e6

                1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

                    \[\leadsto \left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \color{blue}{\left(y - x\right)} + x \]
                  10. sub-negate-revN/A

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

                    \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(6 \cdot \left(\frac{2}{3} - z\right)\right) \cdot \left(x - y\right)\right)\right)} + x \]
                  12. distribute-lft-neg-inN/A

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

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

                    \[\leadsto \left(6 \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\frac{2}{3} - z\right)}\right)\right)\right) \cdot \left(x - y\right) + x \]
                  15. sub-negate-revN/A

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(6 \cdot \left(z - \frac{2}{3}\right), x - y, x\right)} \]
                3. Applied rewrites99.8%

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

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

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

                Alternative 8: 49.8% accurate, 1.0× speedup?

                \[\begin{array}{l} t_0 := y \cdot \left(-6 \cdot z\right)\\ \mathbf{if}\;z \leq -3.3 \cdot 10^{+25}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-134}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 9500000:\\ \;\;\;\;x + -4 \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (let* ((t_0 (* y (* -6.0 z))))
                   (if (<= z -3.3e+25)
                     t_0
                     (if (<= z 1.35e-134)
                       (* y 4.0)
                       (if (<= z 9500000.0) (+ x (* -4.0 x)) t_0)))))
                double code(double x, double y, double z) {
                	double t_0 = y * (-6.0 * z);
                	double tmp;
                	if (z <= -3.3e+25) {
                		tmp = t_0;
                	} else if (z <= 1.35e-134) {
                		tmp = y * 4.0;
                	} else if (z <= 9500000.0) {
                		tmp = x + (-4.0 * x);
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x, y, z)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    real(8) :: t_0
                    real(8) :: tmp
                    t_0 = y * ((-6.0d0) * z)
                    if (z <= (-3.3d+25)) then
                        tmp = t_0
                    else if (z <= 1.35d-134) then
                        tmp = y * 4.0d0
                    else if (z <= 9500000.0d0) then
                        tmp = x + ((-4.0d0) * x)
                    else
                        tmp = t_0
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z) {
                	double t_0 = y * (-6.0 * z);
                	double tmp;
                	if (z <= -3.3e+25) {
                		tmp = t_0;
                	} else if (z <= 1.35e-134) {
                		tmp = y * 4.0;
                	} else if (z <= 9500000.0) {
                		tmp = x + (-4.0 * x);
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	t_0 = y * (-6.0 * z)
                	tmp = 0
                	if z <= -3.3e+25:
                		tmp = t_0
                	elif z <= 1.35e-134:
                		tmp = y * 4.0
                	elif z <= 9500000.0:
                		tmp = x + (-4.0 * x)
                	else:
                		tmp = t_0
                	return tmp
                
                function code(x, y, z)
                	t_0 = Float64(y * Float64(-6.0 * z))
                	tmp = 0.0
                	if (z <= -3.3e+25)
                		tmp = t_0;
                	elseif (z <= 1.35e-134)
                		tmp = Float64(y * 4.0);
                	elseif (z <= 9500000.0)
                		tmp = Float64(x + Float64(-4.0 * x));
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	t_0 = y * (-6.0 * z);
                	tmp = 0.0;
                	if (z <= -3.3e+25)
                		tmp = t_0;
                	elseif (z <= 1.35e-134)
                		tmp = y * 4.0;
                	elseif (z <= 9500000.0)
                		tmp = x + (-4.0 * x);
                	else
                		tmp = t_0;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+25], t$95$0, If[LessEqual[z, 1.35e-134], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 9500000.0], N[(x + N[(-4.0 * x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
                
                \begin{array}{l}
                t_0 := y \cdot \left(-6 \cdot z\right)\\
                \mathbf{if}\;z \leq -3.3 \cdot 10^{+25}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;z \leq 1.35 \cdot 10^{-134}:\\
                \;\;\;\;y \cdot 4\\
                
                \mathbf{elif}\;z \leq 9500000:\\
                \;\;\;\;x + -4 \cdot x\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if z < -3.3000000000000001e25 or 9.5e6 < z

                  1. Initial program 99.5%

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

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

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

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

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

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

                      \[\leadsto \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \frac{2}{3} + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + x \]
                    7. associate-+l+N/A

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

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

                      \[\leadsto \color{blue}{\left(6 \cdot \left(y - x\right)\right)} \cdot \frac{2}{3} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                    10. associate-*l*N/A

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

                      \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot \frac{2}{3}\right) \cdot 6} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                    12. associate-*r*N/A

                      \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right)} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                    13. add-flip-revN/A

                      \[\leadsto \left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right) + \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                    14. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \frac{2}{3} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                    15. lift-/.f64N/A

                      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                    16. metadata-evalN/A

                      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                    17. metadata-evalN/A

                      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4}, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                    18. add-flip-revN/A

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

                      \[\leadsto \mathsf{fma}\left(y - x, 4, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\left(y - x\right) \cdot 6\right)} + x\right) \]
                  3. Applied rewrites99.8%

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

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

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

                      \[\leadsto y \cdot \left(4 + \color{blue}{-6 \cdot z}\right) \]
                    3. lower-*.f6451.3%

                      \[\leadsto y \cdot \left(4 + -6 \cdot \color{blue}{z}\right) \]
                  6. Applied rewrites51.3%

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

                    \[\leadsto y \cdot 4 \]
                  8. Step-by-step derivation
                    1. Applied rewrites25.8%

                      \[\leadsto y \cdot 4 \]
                    2. Taylor expanded in z around inf

                      \[\leadsto y \cdot \left(-6 \cdot \color{blue}{z}\right) \]
                    3. Step-by-step derivation
                      1. lower-*.f6427.5%

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

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

                    if -3.3000000000000001e25 < z < 1.3499999999999999e-134

                    1. Initial program 99.5%

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \frac{2}{3} + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + x \]
                      7. associate-+l+N/A

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

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

                        \[\leadsto \color{blue}{\left(6 \cdot \left(y - x\right)\right)} \cdot \frac{2}{3} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                      10. associate-*l*N/A

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

                        \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot \frac{2}{3}\right) \cdot 6} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                      12. associate-*r*N/A

                        \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right)} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                      13. add-flip-revN/A

                        \[\leadsto \left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right) + \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                      14. lower-fma.f64N/A

                        \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \frac{2}{3} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                      15. lift-/.f64N/A

                        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                      16. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                      17. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4}, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                      18. add-flip-revN/A

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

                        \[\leadsto \mathsf{fma}\left(y - x, 4, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\left(y - x\right) \cdot 6\right)} + x\right) \]
                    3. Applied rewrites99.8%

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

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

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

                        \[\leadsto y \cdot \left(4 + \color{blue}{-6 \cdot z}\right) \]
                      3. lower-*.f6451.3%

                        \[\leadsto y \cdot \left(4 + -6 \cdot \color{blue}{z}\right) \]
                    6. Applied rewrites51.3%

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

                      \[\leadsto y \cdot 4 \]
                    8. Step-by-step derivation
                      1. Applied rewrites25.8%

                        \[\leadsto y \cdot 4 \]

                      if 1.3499999999999999e-134 < z < 9.5e6

                      1. Initial program 99.5%

                        \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
                      2. Taylor expanded in z around 0

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

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

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

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

                        \[\leadsto x + -4 \cdot \color{blue}{x} \]
                      6. Step-by-step derivation
                        1. lower-*.f6426.1%

                          \[\leadsto x + -4 \cdot x \]
                      7. Applied rewrites26.1%

                        \[\leadsto x + -4 \cdot \color{blue}{x} \]
                    9. Recombined 3 regimes into one program.
                    10. Add Preprocessing

                    Alternative 9: 49.8% accurate, 1.0× speedup?

                    \[\begin{array}{l} t_0 := -6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq -3.3 \cdot 10^{+25}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{-134}:\\ \;\;\;\;y \cdot 4\\ \mathbf{elif}\;z \leq 9500000:\\ \;\;\;\;x + -4 \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
                    (FPCore (x y z)
                     :precision binary64
                     (let* ((t_0 (* -6.0 (* y z))))
                       (if (<= z -3.3e+25)
                         t_0
                         (if (<= z 1.35e-134)
                           (* y 4.0)
                           (if (<= z 9500000.0) (+ x (* -4.0 x)) t_0)))))
                    double code(double x, double y, double z) {
                    	double t_0 = -6.0 * (y * z);
                    	double tmp;
                    	if (z <= -3.3e+25) {
                    		tmp = t_0;
                    	} else if (z <= 1.35e-134) {
                    		tmp = y * 4.0;
                    	} else if (z <= 9500000.0) {
                    		tmp = x + (-4.0 * x);
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    module fmin_fmax_functions
                        implicit none
                        private
                        public fmax
                        public fmin
                    
                        interface fmax
                            module procedure fmax88
                            module procedure fmax44
                            module procedure fmax84
                            module procedure fmax48
                        end interface
                        interface fmin
                            module procedure fmin88
                            module procedure fmin44
                            module procedure fmin84
                            module procedure fmin48
                        end interface
                    contains
                        real(8) function fmax88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmax44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmax84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmax48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                        end function
                        real(8) function fmin88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmin44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmin84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmin48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                        end function
                    end module
                    
                    real(8) function code(x, y, z)
                    use fmin_fmax_functions
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        real(8), intent (in) :: z
                        real(8) :: t_0
                        real(8) :: tmp
                        t_0 = (-6.0d0) * (y * z)
                        if (z <= (-3.3d+25)) then
                            tmp = t_0
                        else if (z <= 1.35d-134) then
                            tmp = y * 4.0d0
                        else if (z <= 9500000.0d0) then
                            tmp = x + ((-4.0d0) * x)
                        else
                            tmp = t_0
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double x, double y, double z) {
                    	double t_0 = -6.0 * (y * z);
                    	double tmp;
                    	if (z <= -3.3e+25) {
                    		tmp = t_0;
                    	} else if (z <= 1.35e-134) {
                    		tmp = y * 4.0;
                    	} else if (z <= 9500000.0) {
                    		tmp = x + (-4.0 * x);
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y, z):
                    	t_0 = -6.0 * (y * z)
                    	tmp = 0
                    	if z <= -3.3e+25:
                    		tmp = t_0
                    	elif z <= 1.35e-134:
                    		tmp = y * 4.0
                    	elif z <= 9500000.0:
                    		tmp = x + (-4.0 * x)
                    	else:
                    		tmp = t_0
                    	return tmp
                    
                    function code(x, y, z)
                    	t_0 = Float64(-6.0 * Float64(y * z))
                    	tmp = 0.0
                    	if (z <= -3.3e+25)
                    		tmp = t_0;
                    	elseif (z <= 1.35e-134)
                    		tmp = Float64(y * 4.0);
                    	elseif (z <= 9500000.0)
                    		tmp = Float64(x + Float64(-4.0 * x));
                    	else
                    		tmp = t_0;
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y, z)
                    	t_0 = -6.0 * (y * z);
                    	tmp = 0.0;
                    	if (z <= -3.3e+25)
                    		tmp = t_0;
                    	elseif (z <= 1.35e-134)
                    		tmp = y * 4.0;
                    	elseif (z <= 9500000.0)
                    		tmp = x + (-4.0 * x);
                    	else
                    		tmp = t_0;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+25], t$95$0, If[LessEqual[z, 1.35e-134], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 9500000.0], N[(x + N[(-4.0 * x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
                    
                    \begin{array}{l}
                    t_0 := -6 \cdot \left(y \cdot z\right)\\
                    \mathbf{if}\;z \leq -3.3 \cdot 10^{+25}:\\
                    \;\;\;\;t\_0\\
                    
                    \mathbf{elif}\;z \leq 1.35 \cdot 10^{-134}:\\
                    \;\;\;\;y \cdot 4\\
                    
                    \mathbf{elif}\;z \leq 9500000:\\
                    \;\;\;\;x + -4 \cdot x\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t\_0\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if z < -3.3000000000000001e25 or 9.5e6 < z

                      1. Initial program 99.5%

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \frac{2}{3} + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + x \]
                        7. associate-+l+N/A

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

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

                          \[\leadsto \color{blue}{\left(6 \cdot \left(y - x\right)\right)} \cdot \frac{2}{3} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                        10. associate-*l*N/A

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

                          \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot \frac{2}{3}\right) \cdot 6} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                        12. associate-*r*N/A

                          \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right)} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                        13. add-flip-revN/A

                          \[\leadsto \left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right) + \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                        14. lower-fma.f64N/A

                          \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \frac{2}{3} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                        15. lift-/.f64N/A

                          \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                        16. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                        17. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4}, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                        18. add-flip-revN/A

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

                          \[\leadsto \mathsf{fma}\left(y - x, 4, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\left(y - x\right) \cdot 6\right)} + x\right) \]
                      3. Applied rewrites99.8%

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

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

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

                          \[\leadsto y \cdot \left(4 + \color{blue}{-6 \cdot z}\right) \]
                        3. lower-*.f6451.3%

                          \[\leadsto y \cdot \left(4 + -6 \cdot \color{blue}{z}\right) \]
                      6. Applied rewrites51.3%

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

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

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

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

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

                      if -3.3000000000000001e25 < z < 1.3499999999999999e-134

                      1. Initial program 99.5%

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \frac{2}{3} + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + x \]
                        7. associate-+l+N/A

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

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

                          \[\leadsto \color{blue}{\left(6 \cdot \left(y - x\right)\right)} \cdot \frac{2}{3} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                        10. associate-*l*N/A

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

                          \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot \frac{2}{3}\right) \cdot 6} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                        12. associate-*r*N/A

                          \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right)} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                        13. add-flip-revN/A

                          \[\leadsto \left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right) + \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                        14. lower-fma.f64N/A

                          \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \frac{2}{3} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                        15. lift-/.f64N/A

                          \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                        16. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                        17. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4}, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                        18. add-flip-revN/A

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

                          \[\leadsto \mathsf{fma}\left(y - x, 4, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\left(y - x\right) \cdot 6\right)} + x\right) \]
                      3. Applied rewrites99.8%

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

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

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

                          \[\leadsto y \cdot \left(4 + \color{blue}{-6 \cdot z}\right) \]
                        3. lower-*.f6451.3%

                          \[\leadsto y \cdot \left(4 + -6 \cdot \color{blue}{z}\right) \]
                      6. Applied rewrites51.3%

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

                        \[\leadsto y \cdot 4 \]
                      8. Step-by-step derivation
                        1. Applied rewrites25.8%

                          \[\leadsto y \cdot 4 \]

                        if 1.3499999999999999e-134 < z < 9.5e6

                        1. Initial program 99.5%

                          \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
                        2. Taylor expanded in z around 0

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

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

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

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

                          \[\leadsto x + -4 \cdot \color{blue}{x} \]
                        6. Step-by-step derivation
                          1. lower-*.f6426.1%

                            \[\leadsto x + -4 \cdot x \]
                        7. Applied rewrites26.1%

                          \[\leadsto x + -4 \cdot \color{blue}{x} \]
                      9. Recombined 3 regimes into one program.
                      10. Add Preprocessing

                      Alternative 10: 38.1% accurate, 1.3× speedup?

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

                        1. Initial program 99.5%

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

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

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

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

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

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

                            \[\leadsto \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \frac{2}{3} + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + x \]
                          7. associate-+l+N/A

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

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

                            \[\leadsto \color{blue}{\left(6 \cdot \left(y - x\right)\right)} \cdot \frac{2}{3} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                          10. associate-*l*N/A

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

                            \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot \frac{2}{3}\right) \cdot 6} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                          12. associate-*r*N/A

                            \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right)} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                          13. add-flip-revN/A

                            \[\leadsto \left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right) + \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                          14. lower-fma.f64N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \frac{2}{3} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                          15. lift-/.f64N/A

                            \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                          16. metadata-evalN/A

                            \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                          17. metadata-evalN/A

                            \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4}, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                          18. add-flip-revN/A

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

                            \[\leadsto \mathsf{fma}\left(y - x, 4, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\left(y - x\right) \cdot 6\right)} + x\right) \]
                        3. Applied rewrites99.8%

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

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

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

                            \[\leadsto y \cdot \left(4 + \color{blue}{-6 \cdot z}\right) \]
                          3. lower-*.f6451.3%

                            \[\leadsto y \cdot \left(4 + -6 \cdot \color{blue}{z}\right) \]
                        6. Applied rewrites51.3%

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

                          \[\leadsto y \cdot 4 \]
                        8. Step-by-step derivation
                          1. Applied rewrites25.8%

                            \[\leadsto y \cdot 4 \]

                          if -2.3000000000000002e22 < y < 6.4e13

                          1. Initial program 99.5%

                            \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
                          2. Taylor expanded in z around 0

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

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

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

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

                            \[\leadsto x + -4 \cdot \color{blue}{x} \]
                          6. Step-by-step derivation
                            1. lower-*.f6426.1%

                              \[\leadsto x + -4 \cdot x \]
                          7. Applied rewrites26.1%

                            \[\leadsto x + -4 \cdot \color{blue}{x} \]
                        9. Recombined 2 regimes into one program.
                        10. Add Preprocessing

                        Alternative 11: 25.8% accurate, 4.7× speedup?

                        \[y \cdot 4 \]
                        (FPCore (x y z) :precision binary64 (* y 4.0))
                        double code(double x, double y, double z) {
                        	return y * 4.0;
                        }
                        
                        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 * 4.0d0
                        end function
                        
                        public static double code(double x, double y, double z) {
                        	return y * 4.0;
                        }
                        
                        def code(x, y, z):
                        	return y * 4.0
                        
                        function code(x, y, z)
                        	return Float64(y * 4.0)
                        end
                        
                        function tmp = code(x, y, z)
                        	tmp = y * 4.0;
                        end
                        
                        code[x_, y_, z_] := N[(y * 4.0), $MachinePrecision]
                        
                        y \cdot 4
                        
                        Derivation
                        1. Initial program 99.5%

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

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

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

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

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

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

                            \[\leadsto \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \frac{2}{3} + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right)\right)} + x \]
                          7. associate-+l+N/A

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

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

                            \[\leadsto \color{blue}{\left(6 \cdot \left(y - x\right)\right)} \cdot \frac{2}{3} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                          10. associate-*l*N/A

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

                            \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot \frac{2}{3}\right) \cdot 6} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                          12. associate-*r*N/A

                            \[\leadsto \color{blue}{\left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right)} + \left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + x\right) \]
                          13. add-flip-revN/A

                            \[\leadsto \left(y - x\right) \cdot \left(\frac{2}{3} \cdot 6\right) + \color{blue}{\left(\left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                          14. lower-fma.f64N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, \frac{2}{3} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right)} \]
                          15. lift-/.f64N/A

                            \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                          16. metadata-evalN/A

                            \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{\frac{2}{3}} \cdot 6, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                          17. metadata-evalN/A

                            \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{4}, \left(\left(y - x\right) \cdot 6\right) \cdot \left(\mathsf{neg}\left(z\right)\right) - \left(\mathsf{neg}\left(x\right)\right)\right) \]
                          18. add-flip-revN/A

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

                            \[\leadsto \mathsf{fma}\left(y - x, 4, \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(\left(y - x\right) \cdot 6\right)} + x\right) \]
                        3. Applied rewrites99.8%

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

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

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

                            \[\leadsto y \cdot \left(4 + \color{blue}{-6 \cdot z}\right) \]
                          3. lower-*.f6451.3%

                            \[\leadsto y \cdot \left(4 + -6 \cdot \color{blue}{z}\right) \]
                        6. Applied rewrites51.3%

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

                          \[\leadsto y \cdot 4 \]
                        8. Step-by-step derivation
                          1. Applied rewrites25.8%

                            \[\leadsto y \cdot 4 \]
                          2. Add Preprocessing

                          Reproduce

                          ?
                          herbie shell --seed 2025207 
                          (FPCore (x y z)
                            :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
                            :precision binary64
                            (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))