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

Percentage Accurate: 99.5% → 99.8%
Time: 3.8s
Alternatives: 16
Speedup: 1.3×

Specification

?
\[\begin{array}{l} \\ x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \end{array} \]
(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]
\begin{array}{l}

\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\end{array}

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

\[\begin{array}{l} \\ x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \end{array} \]
(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]
\begin{array}{l}

\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\end{array}

Alternative 1: 99.8% accurate, 1.3× speedup?

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

\\
\mathsf{fma}\left(y - x, \mathsf{fma}\left(-6, z, 4\right), x\right)
\end{array}
Derivation
  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 \color{blue}{x + \left(-6 \cdot \left(z \cdot \left(y - x\right)\right) + 4 \cdot \left(y - x\right)\right)} \]
  3. Step-by-step derivation
    1. +-commutativeN/A

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

      \[\leadsto \left(\left(-6 \cdot z\right) \cdot \left(y - x\right) + 4 \cdot \left(y - x\right)\right) + x \]
    3. distribute-rgt-outN/A

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

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

      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{-6 \cdot z} + 4, x\right) \]
    6. lower-fma.f6499.8

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

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

Alternative 2: 98.0% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.6:\\
\;\;\;\;\left(\left(y - x\right) \cdot z\right) \cdot -6\\

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

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


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

    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 \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \left(\left(y - x\right) \cdot z\right) \cdot -6 \]
      5. lift--.f6450.2

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

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

    if -0.599999999999999978 < z < 0.619999999999999996

    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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    3. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

      \[\leadsto -3 \cdot x + \color{blue}{4 \cdot y} \]
    6. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-3, x, 4 \cdot y\right) \]
      2. lower-*.f6451.3

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

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

    if 0.619999999999999996 < 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 \color{blue}{z \cdot \left(-6 \cdot \left(y - x\right) + \left(4 \cdot \frac{y - x}{z} + \frac{x}{z}\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(-6, y - x, 4 \cdot \frac{y - x}{z} + \frac{x}{z}\right) \cdot z \]
      5. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x}{z} + \frac{4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
      7. div-addN/A

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x + 4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x + 4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{4 \cdot \left(y - x\right) + x}{z}\right) \cdot z \]
      10. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{\mathsf{fma}\left(4, y - x, x\right)}{z}\right) \cdot z \]
      11. lift--.f6480.0

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{\mathsf{fma}\left(4, y - x, x\right)}{z}\right) \cdot z \]
    4. Applied rewrites80.0%

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

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

        \[\leadsto \left(-6 \cdot \left(y - x\right)\right) \cdot z \]
      2. lift--.f6450.3

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

      \[\leadsto \left(-6 \cdot \left(y - x\right)\right) \cdot z \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 98.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(-6 \cdot \left(y - x\right)\right) \cdot z\\ \mathbf{if}\;z \leq -0.6:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 0.62:\\ \;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (* -6.0 (- y x)) z)))
   (if (<= z -0.6) t_0 (if (<= z 0.62) (fma -3.0 x (* 4.0 y)) t_0))))
double code(double x, double y, double z) {
	double t_0 = (-6.0 * (y - x)) * z;
	double tmp;
	if (z <= -0.6) {
		tmp = t_0;
	} else if (z <= 0.62) {
		tmp = fma(-3.0, x, (4.0 * y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(Float64(-6.0 * Float64(y - x)) * z)
	tmp = 0.0
	if (z <= -0.6)
		tmp = t_0;
	elseif (z <= 0.62)
		tmp = fma(-3.0, x, Float64(4.0 * y));
	else
		tmp = t_0;
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -0.6], t$95$0, If[LessEqual[z, 0.62], N[(-3.0 * x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(-6 \cdot \left(y - x\right)\right) \cdot z\\
\mathbf{if}\;z \leq -0.6:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -0.599999999999999978 or 0.619999999999999996 < 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 \color{blue}{z \cdot \left(-6 \cdot \left(y - x\right) + \left(4 \cdot \frac{y - x}{z} + \frac{x}{z}\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(-6, y - x, 4 \cdot \frac{y - x}{z} + \frac{x}{z}\right) \cdot z \]
      5. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x}{z} + \frac{4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
      7. div-addN/A

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x + 4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x + 4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{4 \cdot \left(y - x\right) + x}{z}\right) \cdot z \]
      10. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{\mathsf{fma}\left(4, y - x, x\right)}{z}\right) \cdot z \]
      11. lift--.f6480.0

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{\mathsf{fma}\left(4, y - x, x\right)}{z}\right) \cdot z \]
    4. Applied rewrites80.0%

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

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

        \[\leadsto \left(-6 \cdot \left(y - x\right)\right) \cdot z \]
      2. lift--.f6450.3

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

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

    if -0.599999999999999978 < z < 0.619999999999999996

    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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    3. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

      \[\leadsto -3 \cdot x + \color{blue}{4 \cdot y} \]
    6. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-3, x, 4 \cdot y\right) \]
      2. lower-*.f6451.3

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

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

Alternative 4: 76.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(-6, z, 4\right) \cdot y\\ \mathbf{if}\;y \leq -2.4 \cdot 10^{-43}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-16}:\\ \;\;\;\;\mathsf{fma}\left(z, 6, -3\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (fma -6.0 z 4.0) y)))
   (if (<= y -2.4e-43) t_0 (if (<= y 1.05e-16) (* (fma z 6.0 -3.0) x) t_0))))
double code(double x, double y, double z) {
	double t_0 = fma(-6.0, z, 4.0) * y;
	double tmp;
	if (y <= -2.4e-43) {
		tmp = t_0;
	} else if (y <= 1.05e-16) {
		tmp = fma(z, 6.0, -3.0) * x;
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(fma(-6.0, z, 4.0) * y)
	tmp = 0.0
	if (y <= -2.4e-43)
		tmp = t_0;
	elseif (y <= 1.05e-16)
		tmp = Float64(fma(z, 6.0, -3.0) * x);
	else
		tmp = t_0;
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-6.0 * z + 4.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -2.4e-43], t$95$0, If[LessEqual[y, 1.05e-16], N[(N[(z * 6.0 + -3.0), $MachinePrecision] * x), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-6, z, 4\right) \cdot y\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{-43}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 1.05 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(z, 6, -3\right) \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.4000000000000002e-43 or 1.0500000000000001e-16 < y

    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 \color{blue}{x + \left(-6 \cdot \left(z \cdot \left(y - x\right)\right) + 4 \cdot \left(y - x\right)\right)} \]
    3. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \left(\left(-6 \cdot z\right) \cdot \left(y - x\right) + 4 \cdot \left(y - x\right)\right) + x \]
      3. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{-6 \cdot z} + 4, x\right) \]
      6. lower-fma.f6499.8

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

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

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

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

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

        \[\leadsto \left(-6 \cdot z + 4\right) \cdot y \]
      4. lift-fma.f6452.1

        \[\leadsto \mathsf{fma}\left(-6, z, 4\right) \cdot y \]
    7. Applied rewrites52.1%

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

    if -2.4000000000000002e-43 < y < 1.0500000000000001e-16

    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 x around inf

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
    3. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
      6. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
      7. metadata-eval51.2

        \[\leadsto \mathsf{fma}\left(-6, 0.6666666666666666 - z, 1\right) \cdot x \]
    4. Applied rewrites51.2%

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

      \[\leadsto \left(6 \cdot z - 3\right) \cdot x \]
    6. Step-by-step derivation
      1. sub-flipN/A

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

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

        \[\leadsto \left(z \cdot 6 + -3\right) \cdot x \]
      4. lower-fma.f6451.2

        \[\leadsto \mathsf{fma}\left(z, 6, -3\right) \cdot x \]
    7. Applied rewrites51.2%

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

Alternative 5: 75.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{3} - z\\ t_1 := \mathsf{fma}\left(-6, z, 4\right) \cdot y\\ \mathbf{if}\;t\_0 \leq 0.6666666666:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 1:\\ \;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+108}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot 6\right) \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (/ 2.0 3.0) z)) (t_1 (* (fma -6.0 z 4.0) y)))
   (if (<= t_0 0.6666666666)
     t_1
     (if (<= t_0 1.0)
       (fma -3.0 x (* 4.0 y))
       (if (<= t_0 2e+108) t_1 (* (* z 6.0) x))))))
double code(double x, double y, double z) {
	double t_0 = (2.0 / 3.0) - z;
	double t_1 = fma(-6.0, z, 4.0) * y;
	double tmp;
	if (t_0 <= 0.6666666666) {
		tmp = t_1;
	} else if (t_0 <= 1.0) {
		tmp = fma(-3.0, x, (4.0 * y));
	} else if (t_0 <= 2e+108) {
		tmp = t_1;
	} else {
		tmp = (z * 6.0) * x;
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(Float64(2.0 / 3.0) - z)
	t_1 = Float64(fma(-6.0, z, 4.0) * y)
	tmp = 0.0
	if (t_0 <= 0.6666666666)
		tmp = t_1;
	elseif (t_0 <= 1.0)
		tmp = fma(-3.0, x, Float64(4.0 * y));
	elseif (t_0 <= 2e+108)
		tmp = t_1;
	else
		tmp = Float64(Float64(z * 6.0) * x);
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-6.0 * z + 4.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$0, 0.6666666666], t$95$1, If[LessEqual[t$95$0, 1.0], N[(-3.0 * x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+108], t$95$1, N[(N[(z * 6.0), $MachinePrecision] * x), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{2}{3} - z\\
t_1 := \mathsf{fma}\left(-6, z, 4\right) \cdot y\\
\mathbf{if}\;t\_0 \leq 0.6666666666:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 0.666666666599999957 or 1 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 2.0000000000000001e108

    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 \color{blue}{x + \left(-6 \cdot \left(z \cdot \left(y - x\right)\right) + 4 \cdot \left(y - x\right)\right)} \]
    3. Step-by-step derivation
      1. +-commutativeN/A

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

        \[\leadsto \left(\left(-6 \cdot z\right) \cdot \left(y - x\right) + 4 \cdot \left(y - x\right)\right) + x \]
      3. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{-6 \cdot z} + 4, x\right) \]
      6. lower-fma.f6499.8

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

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

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

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

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

        \[\leadsto \left(-6 \cdot z + 4\right) \cdot y \]
      4. lift-fma.f6452.1

        \[\leadsto \mathsf{fma}\left(-6, z, 4\right) \cdot y \]
    7. Applied rewrites52.1%

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

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

    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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
    3. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

      \[\leadsto -3 \cdot x + \color{blue}{4 \cdot y} \]
    6. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-3, x, 4 \cdot y\right) \]
      2. lower-*.f6451.3

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

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

    if 2.0000000000000001e108 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) 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 x around inf

      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
    3. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
      6. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
      7. metadata-eval51.2

        \[\leadsto \mathsf{fma}\left(-6, 0.6666666666666666 - z, 1\right) \cdot x \]
    4. Applied rewrites51.2%

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

      \[\leadsto \left(6 \cdot z\right) \cdot x \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(z \cdot 6\right) \cdot x \]
      2. lower-*.f6427.3

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

      \[\leadsto \left(z \cdot 6\right) \cdot x \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 75.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{3} - z\\ \mathbf{if}\;t\_0 \leq -0.2:\\ \;\;\;\;\left(-6 \cdot y\right) \cdot z\\ \mathbf{elif}\;t\_0 \leq 1:\\ \;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+108}:\\ \;\;\;\;\left(y \cdot z\right) \cdot -6\\ \mathbf{else}:\\ \;\;\;\;\left(z \cdot 6\right) \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (/ 2.0 3.0) z)))
   (if (<= t_0 -0.2)
     (* (* -6.0 y) z)
     (if (<= t_0 1.0)
       (fma -3.0 x (* 4.0 y))
       (if (<= t_0 2e+108) (* (* y z) -6.0) (* (* z 6.0) x))))))
double code(double x, double y, double z) {
	double t_0 = (2.0 / 3.0) - z;
	double tmp;
	if (t_0 <= -0.2) {
		tmp = (-6.0 * y) * z;
	} else if (t_0 <= 1.0) {
		tmp = fma(-3.0, x, (4.0 * y));
	} else if (t_0 <= 2e+108) {
		tmp = (y * z) * -6.0;
	} else {
		tmp = (z * 6.0) * x;
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(Float64(2.0 / 3.0) - z)
	tmp = 0.0
	if (t_0 <= -0.2)
		tmp = Float64(Float64(-6.0 * y) * z);
	elseif (t_0 <= 1.0)
		tmp = fma(-3.0, x, Float64(4.0 * y));
	elseif (t_0 <= 2e+108)
		tmp = Float64(Float64(y * z) * -6.0);
	else
		tmp = Float64(Float64(z * 6.0) * x);
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$0, -0.2], N[(N[(-6.0 * y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[(-3.0 * x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+108], N[(N[(y * z), $MachinePrecision] * -6.0), $MachinePrecision], N[(N[(z * 6.0), $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{2}{3} - z\\
\mathbf{if}\;t\_0 \leq -0.2:\\
\;\;\;\;\left(-6 \cdot y\right) \cdot z\\

\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+108}:\\
\;\;\;\;\left(y \cdot z\right) \cdot -6\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < -0.20000000000000001

    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 \color{blue}{z \cdot \left(-6 \cdot \left(y - x\right) + \left(4 \cdot \frac{y - x}{z} + \frac{x}{z}\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(-6, y - x, 4 \cdot \frac{y - x}{z} + \frac{x}{z}\right) \cdot z \]
      5. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x}{z} + \frac{4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
      7. div-addN/A

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x + 4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
      8. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x + 4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{4 \cdot \left(y - x\right) + x}{z}\right) \cdot z \]
      10. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{\mathsf{fma}\left(4, y - x, x\right)}{z}\right) \cdot z \]
      11. lift--.f6480.0

        \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{\mathsf{fma}\left(4, y - x, x\right)}{z}\right) \cdot z \]
    4. Applied rewrites80.0%

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

      \[\leadsto \left(y \cdot \left(4 \cdot \frac{1}{z} - 6\right)\right) \cdot z \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\left(4 \cdot \frac{1}{z} - 6\right) \cdot y\right) \cdot z \]
      2. lower-*.f64N/A

        \[\leadsto \left(\left(4 \cdot \frac{1}{z} - 6\right) \cdot y\right) \cdot z \]
      3. lower--.f64N/A

        \[\leadsto \left(\left(4 \cdot \frac{1}{z} - 6\right) \cdot y\right) \cdot z \]
      4. mult-flip-revN/A

        \[\leadsto \left(\left(\frac{4}{z} - 6\right) \cdot y\right) \cdot z \]
      5. lower-/.f6442.2

        \[\leadsto \left(\left(\frac{4}{z} - 6\right) \cdot y\right) \cdot z \]
    7. Applied rewrites42.2%

      \[\leadsto \left(\left(\frac{4}{z} - 6\right) \cdot y\right) \cdot z \]
    8. Taylor expanded in z around inf

      \[\leadsto \left(-6 \cdot y\right) \cdot z \]
    9. Step-by-step derivation
      1. Applied rewrites27.1%

        \[\leadsto \left(-6 \cdot y\right) \cdot z \]

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

      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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
      3. Step-by-step derivation
        1. +-commutativeN/A

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

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

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

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

        \[\leadsto -3 \cdot x + \color{blue}{4 \cdot y} \]
      6. Step-by-step derivation
        1. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(-3, x, 4 \cdot y\right) \]
        2. lower-*.f6451.3

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

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

      if 1 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 2.0000000000000001e108

      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 \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
      3. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

          \[\leadsto \left(\left(y - x\right) \cdot z\right) \cdot -6 \]
        5. lift--.f6450.2

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

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

        \[\leadsto \left(y \cdot z\right) \cdot -6 \]
      6. Step-by-step derivation
        1. Applied rewrites27.1%

          \[\leadsto \left(y \cdot z\right) \cdot -6 \]

        if 2.0000000000000001e108 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) 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 x around inf

          \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
        3. Step-by-step derivation
          1. metadata-evalN/A

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

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

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

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

            \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
          6. lower--.f64N/A

            \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
          7. metadata-eval51.2

            \[\leadsto \mathsf{fma}\left(-6, 0.6666666666666666 - z, 1\right) \cdot x \]
        4. Applied rewrites51.2%

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

          \[\leadsto \left(6 \cdot z\right) \cdot x \]
        6. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \left(z \cdot 6\right) \cdot x \]
          2. lower-*.f6427.3

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

          \[\leadsto \left(z \cdot 6\right) \cdot x \]
      7. Recombined 4 regimes into one program.
      8. Add Preprocessing

      Alternative 7: 75.2% accurate, 0.9× speedup?

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

        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 x around inf

          \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
        3. Step-by-step derivation
          1. metadata-evalN/A

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

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

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

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

            \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
          6. lower--.f64N/A

            \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
          7. metadata-eval51.2

            \[\leadsto \mathsf{fma}\left(-6, 0.6666666666666666 - z, 1\right) \cdot x \]
        4. Applied rewrites51.2%

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

          \[\leadsto \left(6 \cdot z\right) \cdot x \]
        6. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \left(z \cdot 6\right) \cdot x \]
          2. lower-*.f6427.3

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

          \[\leadsto \left(z \cdot 6\right) \cdot x \]

        if -5.4000000000000005e117 < z < -10.5

        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 \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
        3. Step-by-step derivation
          1. *-commutativeN/A

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

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

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

            \[\leadsto \left(\left(y - x\right) \cdot z\right) \cdot -6 \]
          5. lift--.f6450.2

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

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

          \[\leadsto \left(y \cdot z\right) \cdot -6 \]
        6. Step-by-step derivation
          1. Applied rewrites27.1%

            \[\leadsto \left(y \cdot z\right) \cdot -6 \]

          if -10.5 < z < 0.660000000000000031

          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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
          3. Step-by-step derivation
            1. +-commutativeN/A

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

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

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

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

          if 0.660000000000000031 < 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 \color{blue}{z \cdot \left(-6 \cdot \left(y - x\right) + \left(4 \cdot \frac{y - x}{z} + \frac{x}{z}\right)\right)} \]
          3. Step-by-step derivation
            1. *-commutativeN/A

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

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

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

              \[\leadsto \mathsf{fma}\left(-6, y - x, 4 \cdot \frac{y - x}{z} + \frac{x}{z}\right) \cdot z \]
            5. +-commutativeN/A

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

              \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x}{z} + \frac{4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
            7. div-addN/A

              \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x + 4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
            8. lower-/.f64N/A

              \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x + 4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
            9. +-commutativeN/A

              \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{4 \cdot \left(y - x\right) + x}{z}\right) \cdot z \]
            10. lower-fma.f64N/A

              \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{\mathsf{fma}\left(4, y - x, x\right)}{z}\right) \cdot z \]
            11. lift--.f6480.0

              \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{\mathsf{fma}\left(4, y - x, x\right)}{z}\right) \cdot z \]
          4. Applied rewrites80.0%

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

            \[\leadsto \left(y \cdot \left(4 \cdot \frac{1}{z} - 6\right)\right) \cdot z \]
          6. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \left(\left(4 \cdot \frac{1}{z} - 6\right) \cdot y\right) \cdot z \]
            2. lower-*.f64N/A

              \[\leadsto \left(\left(4 \cdot \frac{1}{z} - 6\right) \cdot y\right) \cdot z \]
            3. lower--.f64N/A

              \[\leadsto \left(\left(4 \cdot \frac{1}{z} - 6\right) \cdot y\right) \cdot z \]
            4. mult-flip-revN/A

              \[\leadsto \left(\left(\frac{4}{z} - 6\right) \cdot y\right) \cdot z \]
            5. lower-/.f6442.2

              \[\leadsto \left(\left(\frac{4}{z} - 6\right) \cdot y\right) \cdot z \]
          7. Applied rewrites42.2%

            \[\leadsto \left(\left(\frac{4}{z} - 6\right) \cdot y\right) \cdot z \]
          8. Taylor expanded in z around inf

            \[\leadsto \left(-6 \cdot y\right) \cdot z \]
          9. Step-by-step derivation
            1. Applied rewrites27.1%

              \[\leadsto \left(-6 \cdot y\right) \cdot z \]
          10. Recombined 4 regimes into one program.
          11. Add Preprocessing

          Alternative 8: 50.9% accurate, 1.0× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{+117}:\\ \;\;\;\;\left(z \cdot 6\right) \cdot x\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-35}:\\ \;\;\;\;\left(y \cdot z\right) \cdot -6\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(-6 \cdot y\right) \cdot z\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (<= z -5.4e+117)
             (* (* z 6.0) x)
             (if (<= z -6.5e-35)
               (* (* y z) -6.0)
               (if (<= z 0.66) (* 4.0 y) (* (* -6.0 y) z)))))
          double code(double x, double y, double z) {
          	double tmp;
          	if (z <= -5.4e+117) {
          		tmp = (z * 6.0) * x;
          	} else if (z <= -6.5e-35) {
          		tmp = (y * z) * -6.0;
          	} else if (z <= 0.66) {
          		tmp = 4.0 * y;
          	} else {
          		tmp = (-6.0 * y) * z;
          	}
          	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 (z <= (-5.4d+117)) then
                  tmp = (z * 6.0d0) * x
              else if (z <= (-6.5d-35)) then
                  tmp = (y * z) * (-6.0d0)
              else if (z <= 0.66d0) then
                  tmp = 4.0d0 * y
              else
                  tmp = ((-6.0d0) * y) * z
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z) {
          	double tmp;
          	if (z <= -5.4e+117) {
          		tmp = (z * 6.0) * x;
          	} else if (z <= -6.5e-35) {
          		tmp = (y * z) * -6.0;
          	} else if (z <= 0.66) {
          		tmp = 4.0 * y;
          	} else {
          		tmp = (-6.0 * y) * z;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	tmp = 0
          	if z <= -5.4e+117:
          		tmp = (z * 6.0) * x
          	elif z <= -6.5e-35:
          		tmp = (y * z) * -6.0
          	elif z <= 0.66:
          		tmp = 4.0 * y
          	else:
          		tmp = (-6.0 * y) * z
          	return tmp
          
          function code(x, y, z)
          	tmp = 0.0
          	if (z <= -5.4e+117)
          		tmp = Float64(Float64(z * 6.0) * x);
          	elseif (z <= -6.5e-35)
          		tmp = Float64(Float64(y * z) * -6.0);
          	elseif (z <= 0.66)
          		tmp = Float64(4.0 * y);
          	else
          		tmp = Float64(Float64(-6.0 * y) * z);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	tmp = 0.0;
          	if (z <= -5.4e+117)
          		tmp = (z * 6.0) * x;
          	elseif (z <= -6.5e-35)
          		tmp = (y * z) * -6.0;
          	elseif (z <= 0.66)
          		tmp = 4.0 * y;
          	else
          		tmp = (-6.0 * y) * z;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := If[LessEqual[z, -5.4e+117], N[(N[(z * 6.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -6.5e-35], N[(N[(y * z), $MachinePrecision] * -6.0), $MachinePrecision], If[LessEqual[z, 0.66], N[(4.0 * y), $MachinePrecision], N[(N[(-6.0 * y), $MachinePrecision] * z), $MachinePrecision]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;z \leq -5.4 \cdot 10^{+117}:\\
          \;\;\;\;\left(z \cdot 6\right) \cdot x\\
          
          \mathbf{elif}\;z \leq -6.5 \cdot 10^{-35}:\\
          \;\;\;\;\left(y \cdot z\right) \cdot -6\\
          
          \mathbf{elif}\;z \leq 0.66:\\
          \;\;\;\;4 \cdot y\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(-6 \cdot y\right) \cdot z\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 4 regimes
          2. if z < -5.4000000000000005e117

            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 x around inf

              \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
            3. Step-by-step derivation
              1. metadata-evalN/A

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

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

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

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

                \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
              6. lower--.f64N/A

                \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
              7. metadata-eval51.2

                \[\leadsto \mathsf{fma}\left(-6, 0.6666666666666666 - z, 1\right) \cdot x \]
            4. Applied rewrites51.2%

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

              \[\leadsto \left(6 \cdot z\right) \cdot x \]
            6. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \left(z \cdot 6\right) \cdot x \]
              2. lower-*.f6427.3

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

              \[\leadsto \left(z \cdot 6\right) \cdot x \]

            if -5.4000000000000005e117 < z < -6.4999999999999999e-35

            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 \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
            3. Step-by-step derivation
              1. *-commutativeN/A

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

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

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

                \[\leadsto \left(\left(y - x\right) \cdot z\right) \cdot -6 \]
              5. lift--.f6450.2

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

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

              \[\leadsto \left(y \cdot z\right) \cdot -6 \]
            6. Step-by-step derivation
              1. Applied rewrites27.1%

                \[\leadsto \left(y \cdot z\right) \cdot -6 \]

              if -6.4999999999999999e-35 < z < 0.660000000000000031

              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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
              3. Step-by-step derivation
                1. +-commutativeN/A

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

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

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

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

                \[\leadsto 4 \cdot \color{blue}{y} \]
              6. Step-by-step derivation
                1. lower-*.f6427.2

                  \[\leadsto 4 \cdot y \]
              7. Applied rewrites27.2%

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

              if 0.660000000000000031 < 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 \color{blue}{z \cdot \left(-6 \cdot \left(y - x\right) + \left(4 \cdot \frac{y - x}{z} + \frac{x}{z}\right)\right)} \]
              3. Step-by-step derivation
                1. *-commutativeN/A

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

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

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

                  \[\leadsto \mathsf{fma}\left(-6, y - x, 4 \cdot \frac{y - x}{z} + \frac{x}{z}\right) \cdot z \]
                5. +-commutativeN/A

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

                  \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x}{z} + \frac{4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
                7. div-addN/A

                  \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x + 4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
                8. lower-/.f64N/A

                  \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x + 4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
                9. +-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{4 \cdot \left(y - x\right) + x}{z}\right) \cdot z \]
                10. lower-fma.f64N/A

                  \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{\mathsf{fma}\left(4, y - x, x\right)}{z}\right) \cdot z \]
                11. lift--.f6480.0

                  \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{\mathsf{fma}\left(4, y - x, x\right)}{z}\right) \cdot z \]
              4. Applied rewrites80.0%

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

                \[\leadsto \left(y \cdot \left(4 \cdot \frac{1}{z} - 6\right)\right) \cdot z \]
              6. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \left(\left(4 \cdot \frac{1}{z} - 6\right) \cdot y\right) \cdot z \]
                2. lower-*.f64N/A

                  \[\leadsto \left(\left(4 \cdot \frac{1}{z} - 6\right) \cdot y\right) \cdot z \]
                3. lower--.f64N/A

                  \[\leadsto \left(\left(4 \cdot \frac{1}{z} - 6\right) \cdot y\right) \cdot z \]
                4. mult-flip-revN/A

                  \[\leadsto \left(\left(\frac{4}{z} - 6\right) \cdot y\right) \cdot z \]
                5. lower-/.f6442.2

                  \[\leadsto \left(\left(\frac{4}{z} - 6\right) \cdot y\right) \cdot z \]
              7. Applied rewrites42.2%

                \[\leadsto \left(\left(\frac{4}{z} - 6\right) \cdot y\right) \cdot z \]
              8. Taylor expanded in z around inf

                \[\leadsto \left(-6 \cdot y\right) \cdot z \]
              9. Step-by-step derivation
                1. Applied rewrites27.1%

                  \[\leadsto \left(-6 \cdot y\right) \cdot z \]
              10. Recombined 4 regimes into one program.
              11. Add Preprocessing

              Alternative 9: 50.9% accurate, 1.0× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{+117}:\\ \;\;\;\;\left(z \cdot 6\right) \cdot x\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-35}:\\ \;\;\;\;\left(-6 \cdot z\right) \cdot y\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(-6 \cdot y\right) \cdot z\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (<= z -5.4e+117)
                 (* (* z 6.0) x)
                 (if (<= z -6.5e-35)
                   (* (* -6.0 z) y)
                   (if (<= z 0.66) (* 4.0 y) (* (* -6.0 y) z)))))
              double code(double x, double y, double z) {
              	double tmp;
              	if (z <= -5.4e+117) {
              		tmp = (z * 6.0) * x;
              	} else if (z <= -6.5e-35) {
              		tmp = (-6.0 * z) * y;
              	} else if (z <= 0.66) {
              		tmp = 4.0 * y;
              	} else {
              		tmp = (-6.0 * y) * z;
              	}
              	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 (z <= (-5.4d+117)) then
                      tmp = (z * 6.0d0) * x
                  else if (z <= (-6.5d-35)) then
                      tmp = ((-6.0d0) * z) * y
                  else if (z <= 0.66d0) then
                      tmp = 4.0d0 * y
                  else
                      tmp = ((-6.0d0) * y) * z
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z) {
              	double tmp;
              	if (z <= -5.4e+117) {
              		tmp = (z * 6.0) * x;
              	} else if (z <= -6.5e-35) {
              		tmp = (-6.0 * z) * y;
              	} else if (z <= 0.66) {
              		tmp = 4.0 * y;
              	} else {
              		tmp = (-6.0 * y) * z;
              	}
              	return tmp;
              }
              
              def code(x, y, z):
              	tmp = 0
              	if z <= -5.4e+117:
              		tmp = (z * 6.0) * x
              	elif z <= -6.5e-35:
              		tmp = (-6.0 * z) * y
              	elif z <= 0.66:
              		tmp = 4.0 * y
              	else:
              		tmp = (-6.0 * y) * z
              	return tmp
              
              function code(x, y, z)
              	tmp = 0.0
              	if (z <= -5.4e+117)
              		tmp = Float64(Float64(z * 6.0) * x);
              	elseif (z <= -6.5e-35)
              		tmp = Float64(Float64(-6.0 * z) * y);
              	elseif (z <= 0.66)
              		tmp = Float64(4.0 * y);
              	else
              		tmp = Float64(Float64(-6.0 * y) * z);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z)
              	tmp = 0.0;
              	if (z <= -5.4e+117)
              		tmp = (z * 6.0) * x;
              	elseif (z <= -6.5e-35)
              		tmp = (-6.0 * z) * y;
              	elseif (z <= 0.66)
              		tmp = 4.0 * y;
              	else
              		tmp = (-6.0 * y) * z;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_] := If[LessEqual[z, -5.4e+117], N[(N[(z * 6.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -6.5e-35], N[(N[(-6.0 * z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 0.66], N[(4.0 * y), $MachinePrecision], N[(N[(-6.0 * y), $MachinePrecision] * z), $MachinePrecision]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;z \leq -5.4 \cdot 10^{+117}:\\
              \;\;\;\;\left(z \cdot 6\right) \cdot x\\
              
              \mathbf{elif}\;z \leq -6.5 \cdot 10^{-35}:\\
              \;\;\;\;\left(-6 \cdot z\right) \cdot y\\
              
              \mathbf{elif}\;z \leq 0.66:\\
              \;\;\;\;4 \cdot y\\
              
              \mathbf{else}:\\
              \;\;\;\;\left(-6 \cdot y\right) \cdot z\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 4 regimes
              2. if z < -5.4000000000000005e117

                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 x around inf

                  \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
                3. Step-by-step derivation
                  1. metadata-evalN/A

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
                  6. lower--.f64N/A

                    \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
                  7. metadata-eval51.2

                    \[\leadsto \mathsf{fma}\left(-6, 0.6666666666666666 - z, 1\right) \cdot x \]
                4. Applied rewrites51.2%

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

                  \[\leadsto \left(6 \cdot z\right) \cdot x \]
                6. Step-by-step derivation
                  1. *-commutativeN/A

                    \[\leadsto \left(z \cdot 6\right) \cdot x \]
                  2. lower-*.f6427.3

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

                  \[\leadsto \left(z \cdot 6\right) \cdot x \]

                if -5.4000000000000005e117 < z < -6.4999999999999999e-35

                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 \color{blue}{x + \left(-6 \cdot \left(z \cdot \left(y - x\right)\right) + 4 \cdot \left(y - x\right)\right)} \]
                3. Step-by-step derivation
                  1. +-commutativeN/A

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

                    \[\leadsto \left(\left(-6 \cdot z\right) \cdot \left(y - x\right) + 4 \cdot \left(y - x\right)\right) + x \]
                  3. distribute-rgt-outN/A

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

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

                    \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{-6 \cdot z} + 4, x\right) \]
                  6. lower-fma.f6499.8

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

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

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

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

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

                    \[\leadsto \left(-6 \cdot z + 4\right) \cdot y \]
                  4. lift-fma.f6452.1

                    \[\leadsto \mathsf{fma}\left(-6, z, 4\right) \cdot y \]
                7. Applied rewrites52.1%

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

                  \[\leadsto \left(-6 \cdot z\right) \cdot y \]
                9. Step-by-step derivation
                  1. lower-*.f6427.1

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

                  \[\leadsto \left(-6 \cdot z\right) \cdot y \]

                if -6.4999999999999999e-35 < z < 0.660000000000000031

                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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
                3. Step-by-step derivation
                  1. +-commutativeN/A

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

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

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

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

                  \[\leadsto 4 \cdot \color{blue}{y} \]
                6. Step-by-step derivation
                  1. lower-*.f6427.2

                    \[\leadsto 4 \cdot y \]
                7. Applied rewrites27.2%

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

                if 0.660000000000000031 < 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 \color{blue}{z \cdot \left(-6 \cdot \left(y - x\right) + \left(4 \cdot \frac{y - x}{z} + \frac{x}{z}\right)\right)} \]
                3. Step-by-step derivation
                  1. *-commutativeN/A

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

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

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

                    \[\leadsto \mathsf{fma}\left(-6, y - x, 4 \cdot \frac{y - x}{z} + \frac{x}{z}\right) \cdot z \]
                  5. +-commutativeN/A

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

                    \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x}{z} + \frac{4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
                  7. div-addN/A

                    \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x + 4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
                  8. lower-/.f64N/A

                    \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{x + 4 \cdot \left(y - x\right)}{z}\right) \cdot z \]
                  9. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{4 \cdot \left(y - x\right) + x}{z}\right) \cdot z \]
                  10. lower-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{\mathsf{fma}\left(4, y - x, x\right)}{z}\right) \cdot z \]
                  11. lift--.f6480.0

                    \[\leadsto \mathsf{fma}\left(-6, y - x, \frac{\mathsf{fma}\left(4, y - x, x\right)}{z}\right) \cdot z \]
                4. Applied rewrites80.0%

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

                  \[\leadsto \left(y \cdot \left(4 \cdot \frac{1}{z} - 6\right)\right) \cdot z \]
                6. Step-by-step derivation
                  1. *-commutativeN/A

                    \[\leadsto \left(\left(4 \cdot \frac{1}{z} - 6\right) \cdot y\right) \cdot z \]
                  2. lower-*.f64N/A

                    \[\leadsto \left(\left(4 \cdot \frac{1}{z} - 6\right) \cdot y\right) \cdot z \]
                  3. lower--.f64N/A

                    \[\leadsto \left(\left(4 \cdot \frac{1}{z} - 6\right) \cdot y\right) \cdot z \]
                  4. mult-flip-revN/A

                    \[\leadsto \left(\left(\frac{4}{z} - 6\right) \cdot y\right) \cdot z \]
                  5. lower-/.f6442.2

                    \[\leadsto \left(\left(\frac{4}{z} - 6\right) \cdot y\right) \cdot z \]
                7. Applied rewrites42.2%

                  \[\leadsto \left(\left(\frac{4}{z} - 6\right) \cdot y\right) \cdot z \]
                8. Taylor expanded in z around inf

                  \[\leadsto \left(-6 \cdot y\right) \cdot z \]
                9. Step-by-step derivation
                  1. Applied rewrites27.1%

                    \[\leadsto \left(-6 \cdot y\right) \cdot z \]
                10. Recombined 4 regimes into one program.
                11. Add Preprocessing

                Alternative 10: 50.3% accurate, 1.0× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(-6 \cdot z\right) \cdot y\\ \mathbf{if}\;z \leq -5.4 \cdot 10^{+117}:\\ \;\;\;\;\left(z \cdot 6\right) \cdot x\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-35}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (let* ((t_0 (* (* -6.0 z) y)))
                   (if (<= z -5.4e+117)
                     (* (* z 6.0) x)
                     (if (<= z -6.5e-35) t_0 (if (<= z 0.66) (* 4.0 y) t_0)))))
                double code(double x, double y, double z) {
                	double t_0 = (-6.0 * z) * y;
                	double tmp;
                	if (z <= -5.4e+117) {
                		tmp = (z * 6.0) * x;
                	} else if (z <= -6.5e-35) {
                		tmp = t_0;
                	} else if (z <= 0.66) {
                		tmp = 4.0 * y;
                	} 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) * z) * y
                    if (z <= (-5.4d+117)) then
                        tmp = (z * 6.0d0) * x
                    else if (z <= (-6.5d-35)) then
                        tmp = t_0
                    else if (z <= 0.66d0) then
                        tmp = 4.0d0 * y
                    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 * z) * y;
                	double tmp;
                	if (z <= -5.4e+117) {
                		tmp = (z * 6.0) * x;
                	} else if (z <= -6.5e-35) {
                		tmp = t_0;
                	} else if (z <= 0.66) {
                		tmp = 4.0 * y;
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	t_0 = (-6.0 * z) * y
                	tmp = 0
                	if z <= -5.4e+117:
                		tmp = (z * 6.0) * x
                	elif z <= -6.5e-35:
                		tmp = t_0
                	elif z <= 0.66:
                		tmp = 4.0 * y
                	else:
                		tmp = t_0
                	return tmp
                
                function code(x, y, z)
                	t_0 = Float64(Float64(-6.0 * z) * y)
                	tmp = 0.0
                	if (z <= -5.4e+117)
                		tmp = Float64(Float64(z * 6.0) * x);
                	elseif (z <= -6.5e-35)
                		tmp = t_0;
                	elseif (z <= 0.66)
                		tmp = Float64(4.0 * y);
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	t_0 = (-6.0 * z) * y;
                	tmp = 0.0;
                	if (z <= -5.4e+117)
                		tmp = (z * 6.0) * x;
                	elseif (z <= -6.5e-35)
                		tmp = t_0;
                	elseif (z <= 0.66)
                		tmp = 4.0 * y;
                	else
                		tmp = t_0;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-6.0 * z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -5.4e+117], N[(N[(z * 6.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -6.5e-35], t$95$0, If[LessEqual[z, 0.66], N[(4.0 * y), $MachinePrecision], t$95$0]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \left(-6 \cdot z\right) \cdot y\\
                \mathbf{if}\;z \leq -5.4 \cdot 10^{+117}:\\
                \;\;\;\;\left(z \cdot 6\right) \cdot x\\
                
                \mathbf{elif}\;z \leq -6.5 \cdot 10^{-35}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;z \leq 0.66:\\
                \;\;\;\;4 \cdot y\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if z < -5.4000000000000005e117

                  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 x around inf

                    \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
                  3. Step-by-step derivation
                    1. metadata-evalN/A

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
                    6. lower--.f64N/A

                      \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
                    7. metadata-eval51.2

                      \[\leadsto \mathsf{fma}\left(-6, 0.6666666666666666 - z, 1\right) \cdot x \]
                  4. Applied rewrites51.2%

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

                    \[\leadsto \left(6 \cdot z\right) \cdot x \]
                  6. Step-by-step derivation
                    1. *-commutativeN/A

                      \[\leadsto \left(z \cdot 6\right) \cdot x \]
                    2. lower-*.f6427.3

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

                    \[\leadsto \left(z \cdot 6\right) \cdot x \]

                  if -5.4000000000000005e117 < z < -6.4999999999999999e-35 or 0.660000000000000031 < 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 0

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

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

                      \[\leadsto \left(\left(-6 \cdot z\right) \cdot \left(y - x\right) + 4 \cdot \left(y - x\right)\right) + x \]
                    3. distribute-rgt-outN/A

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

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

                      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{-6 \cdot z} + 4, x\right) \]
                    6. lower-fma.f6499.8

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

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

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

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

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

                      \[\leadsto \left(-6 \cdot z + 4\right) \cdot y \]
                    4. lift-fma.f6452.1

                      \[\leadsto \mathsf{fma}\left(-6, z, 4\right) \cdot y \]
                  7. Applied rewrites52.1%

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

                    \[\leadsto \left(-6 \cdot z\right) \cdot y \]
                  9. Step-by-step derivation
                    1. lower-*.f6427.1

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

                    \[\leadsto \left(-6 \cdot z\right) \cdot y \]

                  if -6.4999999999999999e-35 < z < 0.660000000000000031

                  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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
                  3. Step-by-step derivation
                    1. +-commutativeN/A

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

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

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

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

                    \[\leadsto 4 \cdot \color{blue}{y} \]
                  6. Step-by-step derivation
                    1. lower-*.f6427.2

                      \[\leadsto 4 \cdot y \]
                  7. Applied rewrites27.2%

                    \[\leadsto 4 \cdot \color{blue}{y} \]
                3. Recombined 3 regimes into one program.
                4. Add Preprocessing

                Alternative 11: 50.3% accurate, 1.0× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(-6 \cdot z\right) \cdot y\\ \mathbf{if}\;z \leq -5.4 \cdot 10^{+117}:\\ \;\;\;\;\left(6 \cdot x\right) \cdot z\\ \mathbf{elif}\;z \leq -6.5 \cdot 10^{-35}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 0.66:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (let* ((t_0 (* (* -6.0 z) y)))
                   (if (<= z -5.4e+117)
                     (* (* 6.0 x) z)
                     (if (<= z -6.5e-35) t_0 (if (<= z 0.66) (* 4.0 y) t_0)))))
                double code(double x, double y, double z) {
                	double t_0 = (-6.0 * z) * y;
                	double tmp;
                	if (z <= -5.4e+117) {
                		tmp = (6.0 * x) * z;
                	} else if (z <= -6.5e-35) {
                		tmp = t_0;
                	} else if (z <= 0.66) {
                		tmp = 4.0 * y;
                	} 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) * z) * y
                    if (z <= (-5.4d+117)) then
                        tmp = (6.0d0 * x) * z
                    else if (z <= (-6.5d-35)) then
                        tmp = t_0
                    else if (z <= 0.66d0) then
                        tmp = 4.0d0 * y
                    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 * z) * y;
                	double tmp;
                	if (z <= -5.4e+117) {
                		tmp = (6.0 * x) * z;
                	} else if (z <= -6.5e-35) {
                		tmp = t_0;
                	} else if (z <= 0.66) {
                		tmp = 4.0 * y;
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	t_0 = (-6.0 * z) * y
                	tmp = 0
                	if z <= -5.4e+117:
                		tmp = (6.0 * x) * z
                	elif z <= -6.5e-35:
                		tmp = t_0
                	elif z <= 0.66:
                		tmp = 4.0 * y
                	else:
                		tmp = t_0
                	return tmp
                
                function code(x, y, z)
                	t_0 = Float64(Float64(-6.0 * z) * y)
                	tmp = 0.0
                	if (z <= -5.4e+117)
                		tmp = Float64(Float64(6.0 * x) * z);
                	elseif (z <= -6.5e-35)
                		tmp = t_0;
                	elseif (z <= 0.66)
                		tmp = Float64(4.0 * y);
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	t_0 = (-6.0 * z) * y;
                	tmp = 0.0;
                	if (z <= -5.4e+117)
                		tmp = (6.0 * x) * z;
                	elseif (z <= -6.5e-35)
                		tmp = t_0;
                	elseif (z <= 0.66)
                		tmp = 4.0 * y;
                	else
                		tmp = t_0;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-6.0 * z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -5.4e+117], N[(N[(6.0 * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, -6.5e-35], t$95$0, If[LessEqual[z, 0.66], N[(4.0 * y), $MachinePrecision], t$95$0]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \left(-6 \cdot z\right) \cdot y\\
                \mathbf{if}\;z \leq -5.4 \cdot 10^{+117}:\\
                \;\;\;\;\left(6 \cdot x\right) \cdot z\\
                
                \mathbf{elif}\;z \leq -6.5 \cdot 10^{-35}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;z \leq 0.66:\\
                \;\;\;\;4 \cdot y\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if z < -5.4000000000000005e117

                  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 x around inf

                    \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
                  3. Step-by-step derivation
                    1. metadata-evalN/A

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
                    6. lower--.f64N/A

                      \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
                    7. metadata-eval51.2

                      \[\leadsto \mathsf{fma}\left(-6, 0.6666666666666666 - z, 1\right) \cdot x \]
                  4. Applied rewrites51.2%

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

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

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

                      \[\leadsto \left(6 \cdot x\right) \cdot z \]
                    3. lower-*.f6427.4

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

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

                  if -5.4000000000000005e117 < z < -6.4999999999999999e-35 or 0.660000000000000031 < 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 0

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

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

                      \[\leadsto \left(\left(-6 \cdot z\right) \cdot \left(y - x\right) + 4 \cdot \left(y - x\right)\right) + x \]
                    3. distribute-rgt-outN/A

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

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

                      \[\leadsto \mathsf{fma}\left(y - x, \color{blue}{-6 \cdot z} + 4, x\right) \]
                    6. lower-fma.f6499.8

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

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

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

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

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

                      \[\leadsto \left(-6 \cdot z + 4\right) \cdot y \]
                    4. lift-fma.f6452.1

                      \[\leadsto \mathsf{fma}\left(-6, z, 4\right) \cdot y \]
                  7. Applied rewrites52.1%

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

                    \[\leadsto \left(-6 \cdot z\right) \cdot y \]
                  9. Step-by-step derivation
                    1. lower-*.f6427.1

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

                    \[\leadsto \left(-6 \cdot z\right) \cdot y \]

                  if -6.4999999999999999e-35 < z < 0.660000000000000031

                  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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
                  3. Step-by-step derivation
                    1. +-commutativeN/A

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

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

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

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

                    \[\leadsto 4 \cdot \color{blue}{y} \]
                  6. Step-by-step derivation
                    1. lower-*.f6427.2

                      \[\leadsto 4 \cdot y \]
                  7. Applied rewrites27.2%

                    \[\leadsto 4 \cdot \color{blue}{y} \]
                3. Recombined 3 regimes into one program.
                4. Add Preprocessing

                Alternative 12: 50.3% accurate, 0.7× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{3} - z\\ t_1 := \left(6 \cdot x\right) \cdot z\\ \mathbf{if}\;t\_0 \leq -0.2:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (let* ((t_0 (- (/ 2.0 3.0) z)) (t_1 (* (* 6.0 x) z)))
                   (if (<= t_0 -0.2) t_1 (if (<= t_0 5e+24) (* 4.0 y) t_1))))
                double code(double x, double y, double z) {
                	double t_0 = (2.0 / 3.0) - z;
                	double t_1 = (6.0 * x) * z;
                	double tmp;
                	if (t_0 <= -0.2) {
                		tmp = t_1;
                	} else if (t_0 <= 5e+24) {
                		tmp = 4.0 * y;
                	} else {
                		tmp = t_1;
                	}
                	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) :: t_1
                    real(8) :: tmp
                    t_0 = (2.0d0 / 3.0d0) - z
                    t_1 = (6.0d0 * x) * z
                    if (t_0 <= (-0.2d0)) then
                        tmp = t_1
                    else if (t_0 <= 5d+24) then
                        tmp = 4.0d0 * y
                    else
                        tmp = t_1
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z) {
                	double t_0 = (2.0 / 3.0) - z;
                	double t_1 = (6.0 * x) * z;
                	double tmp;
                	if (t_0 <= -0.2) {
                		tmp = t_1;
                	} else if (t_0 <= 5e+24) {
                		tmp = 4.0 * y;
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	t_0 = (2.0 / 3.0) - z
                	t_1 = (6.0 * x) * z
                	tmp = 0
                	if t_0 <= -0.2:
                		tmp = t_1
                	elif t_0 <= 5e+24:
                		tmp = 4.0 * y
                	else:
                		tmp = t_1
                	return tmp
                
                function code(x, y, z)
                	t_0 = Float64(Float64(2.0 / 3.0) - z)
                	t_1 = Float64(Float64(6.0 * x) * z)
                	tmp = 0.0
                	if (t_0 <= -0.2)
                		tmp = t_1;
                	elseif (t_0 <= 5e+24)
                		tmp = Float64(4.0 * y);
                	else
                		tmp = t_1;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	t_0 = (2.0 / 3.0) - z;
                	t_1 = (6.0 * x) * z;
                	tmp = 0.0;
                	if (t_0 <= -0.2)
                		tmp = t_1;
                	elseif (t_0 <= 5e+24)
                		tmp = 4.0 * y;
                	else
                		tmp = t_1;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := Block[{t$95$0 = N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(6.0 * x), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$0, -0.2], t$95$1, If[LessEqual[t$95$0, 5e+24], N[(4.0 * y), $MachinePrecision], t$95$1]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \frac{2}{3} - z\\
                t_1 := \left(6 \cdot x\right) \cdot z\\
                \mathbf{if}\;t\_0 \leq -0.2:\\
                \;\;\;\;t\_1\\
                
                \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+24}:\\
                \;\;\;\;4 \cdot y\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_1\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < -0.20000000000000001 or 5.00000000000000045e24 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) 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 x around inf

                    \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
                  3. Step-by-step derivation
                    1. metadata-evalN/A

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
                    6. lower--.f64N/A

                      \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
                    7. metadata-eval51.2

                      \[\leadsto \mathsf{fma}\left(-6, 0.6666666666666666 - z, 1\right) \cdot x \]
                  4. Applied rewrites51.2%

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

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

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

                      \[\leadsto \left(6 \cdot x\right) \cdot z \]
                    3. lower-*.f6427.4

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

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

                  if -0.20000000000000001 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 5.00000000000000045e24

                  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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
                  3. Step-by-step derivation
                    1. +-commutativeN/A

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

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

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

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

                    \[\leadsto 4 \cdot \color{blue}{y} \]
                  6. Step-by-step derivation
                    1. lower-*.f6427.2

                      \[\leadsto 4 \cdot y \]
                  7. Applied rewrites27.2%

                    \[\leadsto 4 \cdot \color{blue}{y} \]
                3. Recombined 2 regimes into one program.
                4. Add Preprocessing

                Alternative 13: 50.3% accurate, 0.7× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{3} - z\\ t_1 := \left(z \cdot x\right) \cdot 6\\ \mathbf{if}\;t\_0 \leq -0.2:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+24}:\\ \;\;\;\;4 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (let* ((t_0 (- (/ 2.0 3.0) z)) (t_1 (* (* z x) 6.0)))
                   (if (<= t_0 -0.2) t_1 (if (<= t_0 5e+24) (* 4.0 y) t_1))))
                double code(double x, double y, double z) {
                	double t_0 = (2.0 / 3.0) - z;
                	double t_1 = (z * x) * 6.0;
                	double tmp;
                	if (t_0 <= -0.2) {
                		tmp = t_1;
                	} else if (t_0 <= 5e+24) {
                		tmp = 4.0 * y;
                	} else {
                		tmp = t_1;
                	}
                	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) :: t_1
                    real(8) :: tmp
                    t_0 = (2.0d0 / 3.0d0) - z
                    t_1 = (z * x) * 6.0d0
                    if (t_0 <= (-0.2d0)) then
                        tmp = t_1
                    else if (t_0 <= 5d+24) then
                        tmp = 4.0d0 * y
                    else
                        tmp = t_1
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z) {
                	double t_0 = (2.0 / 3.0) - z;
                	double t_1 = (z * x) * 6.0;
                	double tmp;
                	if (t_0 <= -0.2) {
                		tmp = t_1;
                	} else if (t_0 <= 5e+24) {
                		tmp = 4.0 * y;
                	} else {
                		tmp = t_1;
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	t_0 = (2.0 / 3.0) - z
                	t_1 = (z * x) * 6.0
                	tmp = 0
                	if t_0 <= -0.2:
                		tmp = t_1
                	elif t_0 <= 5e+24:
                		tmp = 4.0 * y
                	else:
                		tmp = t_1
                	return tmp
                
                function code(x, y, z)
                	t_0 = Float64(Float64(2.0 / 3.0) - z)
                	t_1 = Float64(Float64(z * x) * 6.0)
                	tmp = 0.0
                	if (t_0 <= -0.2)
                		tmp = t_1;
                	elseif (t_0 <= 5e+24)
                		tmp = Float64(4.0 * y);
                	else
                		tmp = t_1;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	t_0 = (2.0 / 3.0) - z;
                	t_1 = (z * x) * 6.0;
                	tmp = 0.0;
                	if (t_0 <= -0.2)
                		tmp = t_1;
                	elseif (t_0 <= 5e+24)
                		tmp = 4.0 * y;
                	else
                		tmp = t_1;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := Block[{t$95$0 = N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z * x), $MachinePrecision] * 6.0), $MachinePrecision]}, If[LessEqual[t$95$0, -0.2], t$95$1, If[LessEqual[t$95$0, 5e+24], N[(4.0 * y), $MachinePrecision], t$95$1]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \frac{2}{3} - z\\
                t_1 := \left(z \cdot x\right) \cdot 6\\
                \mathbf{if}\;t\_0 \leq -0.2:\\
                \;\;\;\;t\_1\\
                
                \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+24}:\\
                \;\;\;\;4 \cdot y\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_1\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < -0.20000000000000001 or 5.00000000000000045e24 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) 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 \color{blue}{-6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
                  3. Step-by-step derivation
                    1. *-commutativeN/A

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

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

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

                      \[\leadsto \left(\left(y - x\right) \cdot z\right) \cdot -6 \]
                    5. lift--.f6450.2

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

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

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

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

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

                      \[\leadsto \left(z \cdot x\right) \cdot 6 \]
                    4. lower-*.f6427.3

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

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

                  if -0.20000000000000001 < (-.f64 (/.f64 #s(literal 2 binary64) #s(literal 3 binary64)) z) < 5.00000000000000045e24

                  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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
                  3. Step-by-step derivation
                    1. +-commutativeN/A

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

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

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

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

                    \[\leadsto 4 \cdot \color{blue}{y} \]
                  6. Step-by-step derivation
                    1. lower-*.f6427.2

                      \[\leadsto 4 \cdot y \]
                  7. Applied rewrites27.2%

                    \[\leadsto 4 \cdot \color{blue}{y} \]
                3. Recombined 2 regimes into one program.
                4. Add Preprocessing

                Alternative 14: 38.8% accurate, 1.6× speedup?

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

                  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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
                  3. Step-by-step derivation
                    1. +-commutativeN/A

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(4, y, x\right) \]
                  6. Step-by-step derivation
                    1. Applied rewrites26.9%

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

                    if -8.5e9 < y < 1.49999999999999995e-69

                    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 x around inf

                      \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
                    3. Step-by-step derivation
                      1. metadata-evalN/A

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
                      6. lower--.f64N/A

                        \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
                      7. metadata-eval51.2

                        \[\leadsto \mathsf{fma}\left(-6, 0.6666666666666666 - z, 1\right) \cdot x \]
                    4. Applied rewrites51.2%

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

                      \[\leadsto -3 \cdot x \]
                    6. Step-by-step derivation
                      1. Applied rewrites26.1%

                        \[\leadsto -3 \cdot x \]

                      if 1.49999999999999995e-69 < y

                      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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
                      3. Step-by-step derivation
                        1. +-commutativeN/A

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

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

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

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

                        \[\leadsto 4 \cdot \color{blue}{y} \]
                      6. Step-by-step derivation
                        1. lower-*.f6427.2

                          \[\leadsto 4 \cdot y \]
                      7. Applied rewrites27.2%

                        \[\leadsto 4 \cdot \color{blue}{y} \]
                    7. Recombined 3 regimes into one program.
                    8. Add Preprocessing

                    Alternative 15: 38.7% accurate, 1.6× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -8500000000:\\ \;\;\;\;4 \cdot y\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{-69}:\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;4 \cdot y\\ \end{array} \end{array} \]
                    (FPCore (x y z)
                     :precision binary64
                     (if (<= y -8500000000.0) (* 4.0 y) (if (<= y 1.5e-69) (* -3.0 x) (* 4.0 y))))
                    double code(double x, double y, double z) {
                    	double tmp;
                    	if (y <= -8500000000.0) {
                    		tmp = 4.0 * y;
                    	} else if (y <= 1.5e-69) {
                    		tmp = -3.0 * x;
                    	} else {
                    		tmp = 4.0 * y;
                    	}
                    	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 <= (-8500000000.0d0)) then
                            tmp = 4.0d0 * y
                        else if (y <= 1.5d-69) then
                            tmp = (-3.0d0) * x
                        else
                            tmp = 4.0d0 * y
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double x, double y, double z) {
                    	double tmp;
                    	if (y <= -8500000000.0) {
                    		tmp = 4.0 * y;
                    	} else if (y <= 1.5e-69) {
                    		tmp = -3.0 * x;
                    	} else {
                    		tmp = 4.0 * y;
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y, z):
                    	tmp = 0
                    	if y <= -8500000000.0:
                    		tmp = 4.0 * y
                    	elif y <= 1.5e-69:
                    		tmp = -3.0 * x
                    	else:
                    		tmp = 4.0 * y
                    	return tmp
                    
                    function code(x, y, z)
                    	tmp = 0.0
                    	if (y <= -8500000000.0)
                    		tmp = Float64(4.0 * y);
                    	elseif (y <= 1.5e-69)
                    		tmp = Float64(-3.0 * x);
                    	else
                    		tmp = Float64(4.0 * y);
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y, z)
                    	tmp = 0.0;
                    	if (y <= -8500000000.0)
                    		tmp = 4.0 * y;
                    	elseif (y <= 1.5e-69)
                    		tmp = -3.0 * x;
                    	else
                    		tmp = 4.0 * y;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_, z_] := If[LessEqual[y, -8500000000.0], N[(4.0 * y), $MachinePrecision], If[LessEqual[y, 1.5e-69], N[(-3.0 * x), $MachinePrecision], N[(4.0 * y), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;y \leq -8500000000:\\
                    \;\;\;\;4 \cdot y\\
                    
                    \mathbf{elif}\;y \leq 1.5 \cdot 10^{-69}:\\
                    \;\;\;\;-3 \cdot x\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;4 \cdot y\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if y < -8.5e9 or 1.49999999999999995e-69 < y

                      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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
                      3. Step-by-step derivation
                        1. +-commutativeN/A

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

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

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

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

                        \[\leadsto 4 \cdot \color{blue}{y} \]
                      6. Step-by-step derivation
                        1. lower-*.f6427.2

                          \[\leadsto 4 \cdot y \]
                      7. Applied rewrites27.2%

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

                      if -8.5e9 < y < 1.49999999999999995e-69

                      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 x around inf

                        \[\leadsto \color{blue}{x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
                      3. Step-by-step derivation
                        1. metadata-evalN/A

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
                        6. lower--.f64N/A

                          \[\leadsto \mathsf{fma}\left(-6, \frac{2}{3} - z, 1\right) \cdot x \]
                        7. metadata-eval51.2

                          \[\leadsto \mathsf{fma}\left(-6, 0.6666666666666666 - z, 1\right) \cdot x \]
                      4. Applied rewrites51.2%

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

                        \[\leadsto -3 \cdot x \]
                      6. Step-by-step derivation
                        1. Applied rewrites26.1%

                          \[\leadsto -3 \cdot x \]
                      7. Recombined 2 regimes into one program.
                      8. Add Preprocessing

                      Alternative 16: 27.2% accurate, 4.6× speedup?

                      \[\begin{array}{l} \\ 4 \cdot y \end{array} \]
                      (FPCore (x y z) :precision binary64 (* 4.0 y))
                      double code(double x, double y, double z) {
                      	return 4.0 * y;
                      }
                      
                      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 = 4.0d0 * y
                      end function
                      
                      public static double code(double x, double y, double z) {
                      	return 4.0 * y;
                      }
                      
                      def code(x, y, z):
                      	return 4.0 * y
                      
                      function code(x, y, z)
                      	return Float64(4.0 * y)
                      end
                      
                      function tmp = code(x, y, z)
                      	tmp = 4.0 * y;
                      end
                      
                      code[x_, y_, z_] := N[(4.0 * y), $MachinePrecision]
                      
                      \begin{array}{l}
                      
                      \\
                      4 \cdot y
                      \end{array}
                      
                      Derivation
                      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 \color{blue}{x + 4 \cdot \left(y - x\right)} \]
                      3. Step-by-step derivation
                        1. +-commutativeN/A

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

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

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

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

                        \[\leadsto 4 \cdot \color{blue}{y} \]
                      6. Step-by-step derivation
                        1. lower-*.f6427.2

                          \[\leadsto 4 \cdot y \]
                      7. Applied rewrites27.2%

                        \[\leadsto 4 \cdot \color{blue}{y} \]
                      8. Add Preprocessing

                      Reproduce

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