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

Percentage Accurate: 99.5% → 99.8%
Time: 7.7s
Alternatives: 12
Speedup: 1.9×

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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 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.9× 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. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{6 \cdot \left(y \cdot \left(\frac{2}{3} - z\right)\right) + x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\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: 75.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(-6, z, 4\right) \cdot y\\ \mathbf{if}\;z \leq -5.5 \cdot 10^{+80}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -810:\\ \;\;\;\;\left(6 \cdot x\right) \cdot z\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-12}:\\ \;\;\;\;\mathsf{fma}\left(y - x, 4, x\right)\\ \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 (<= z -5.5e+80)
     t_0
     (if (<= z -810.0)
       (* (* 6.0 x) z)
       (if (<= z 8.5e-12) (fma (- y x) 4.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 (z <= -5.5e+80) {
		tmp = t_0;
	} else if (z <= -810.0) {
		tmp = (6.0 * x) * z;
	} else if (z <= 8.5e-12) {
		tmp = fma((y - x), 4.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 (z <= -5.5e+80)
		tmp = t_0;
	elseif (z <= -810.0)
		tmp = Float64(Float64(6.0 * x) * z);
	elseif (z <= 8.5e-12)
		tmp = fma(Float64(y - x), 4.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[z, -5.5e+80], t$95$0, If[LessEqual[z, -810.0], N[(N[(6.0 * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 8.5e-12], N[(N[(y - x), $MachinePrecision] * 4.0 + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -810:\\
\;\;\;\;\left(6 \cdot x\right) \cdot z\\

\mathbf{elif}\;z \leq 8.5 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(y - x, 4, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.49999999999999967e80 or 8.4999999999999997e-12 < z

    1. Initial program 99.8%

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

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

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

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

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

        \[\leadsto \left(6 \cdot \left(\frac{2}{3} - \color{blue}{1 \cdot z}\right)\right) \cdot y \]
      5. metadata-evalN/A

        \[\leadsto \left(6 \cdot \left(\frac{2}{3} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right)\right) \cdot y \]
      6. fp-cancel-sign-sub-invN/A

        \[\leadsto \left(6 \cdot \color{blue}{\left(\frac{2}{3} + -1 \cdot z\right)}\right) \cdot y \]
      7. distribute-rgt-inN/A

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

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

        \[\leadsto \color{blue}{\left(4 - \left(\mathsf{neg}\left(-1 \cdot z\right)\right) \cdot 6\right)} \cdot y \]
      10. distribute-lft-neg-inN/A

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

        \[\leadsto \left(4 - \left(\color{blue}{1} \cdot z\right) \cdot 6\right) \cdot y \]
      12. *-lft-identityN/A

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

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

        \[\leadsto \left(4 - \color{blue}{\left(\mathsf{neg}\left(z \cdot -6\right)\right)}\right) \cdot y \]
      15. distribute-lft-neg-inN/A

        \[\leadsto \left(4 - \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot -6}\right) \cdot y \]
      16. fp-cancel-sign-sub-invN/A

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

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

        \[\leadsto \color{blue}{\left(-6 \cdot z + 4\right)} \cdot y \]
      19. lower-fma.f6461.2

        \[\leadsto \color{blue}{\mathsf{fma}\left(-6, z, 4\right)} \cdot y \]
    5. Applied rewrites61.2%

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

    if -5.49999999999999967e80 < z < -810

    1. Initial program 99.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - z\right), x, x\right)} \]
      5. *-lft-identityN/A

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

        \[\leadsto \mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right), x, x\right) \]
      7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -810 < z < 8.4999999999999997e-12

        1. Initial program 99.3%

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

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

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

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

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

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

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

      Alternative 3: 74.8% accurate, 1.1× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+80}:\\ \;\;\;\;\left(-6 \cdot z\right) \cdot y\\ \mathbf{elif}\;z \leq -810:\\ \;\;\;\;\left(6 \cdot x\right) \cdot z\\ \mathbf{elif}\;z \leq 0.65:\\ \;\;\;\;\mathsf{fma}\left(y - x, 4, x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-6 \cdot y\right) \cdot z\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (<= z -5.5e+80)
         (* (* -6.0 z) y)
         (if (<= z -810.0)
           (* (* 6.0 x) z)
           (if (<= z 0.65) (fma (- y x) 4.0 x) (* (* -6.0 y) z)))))
      double code(double x, double y, double z) {
      	double tmp;
      	if (z <= -5.5e+80) {
      		tmp = (-6.0 * z) * y;
      	} else if (z <= -810.0) {
      		tmp = (6.0 * x) * z;
      	} else if (z <= 0.65) {
      		tmp = fma((y - x), 4.0, x);
      	} else {
      		tmp = (-6.0 * y) * z;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	tmp = 0.0
      	if (z <= -5.5e+80)
      		tmp = Float64(Float64(-6.0 * z) * y);
      	elseif (z <= -810.0)
      		tmp = Float64(Float64(6.0 * x) * z);
      	elseif (z <= 0.65)
      		tmp = fma(Float64(y - x), 4.0, x);
      	else
      		tmp = Float64(Float64(-6.0 * y) * z);
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := If[LessEqual[z, -5.5e+80], N[(N[(-6.0 * z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, -810.0], N[(N[(6.0 * x), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 0.65], N[(N[(y - x), $MachinePrecision] * 4.0 + x), $MachinePrecision], N[(N[(-6.0 * y), $MachinePrecision] * z), $MachinePrecision]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;z \leq -5.5 \cdot 10^{+80}:\\
      \;\;\;\;\left(-6 \cdot z\right) \cdot y\\
      
      \mathbf{elif}\;z \leq -810:\\
      \;\;\;\;\left(6 \cdot x\right) \cdot z\\
      
      \mathbf{elif}\;z \leq 0.65:\\
      \;\;\;\;\mathsf{fma}\left(y - x, 4, 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.49999999999999967e80

        1. Initial program 99.8%

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

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

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

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

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

            \[\leadsto \left(6 \cdot \left(\frac{2}{3} - \color{blue}{1 \cdot z}\right)\right) \cdot y \]
          5. metadata-evalN/A

            \[\leadsto \left(6 \cdot \left(\frac{2}{3} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right)\right) \cdot y \]
          6. fp-cancel-sign-sub-invN/A

            \[\leadsto \left(6 \cdot \color{blue}{\left(\frac{2}{3} + -1 \cdot z\right)}\right) \cdot y \]
          7. distribute-rgt-inN/A

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

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

            \[\leadsto \color{blue}{\left(4 - \left(\mathsf{neg}\left(-1 \cdot z\right)\right) \cdot 6\right)} \cdot y \]
          10. distribute-lft-neg-inN/A

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

            \[\leadsto \left(4 - \left(\color{blue}{1} \cdot z\right) \cdot 6\right) \cdot y \]
          12. *-lft-identityN/A

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

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

            \[\leadsto \left(4 - \color{blue}{\left(\mathsf{neg}\left(z \cdot -6\right)\right)}\right) \cdot y \]
          15. distribute-lft-neg-inN/A

            \[\leadsto \left(4 - \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot -6}\right) \cdot y \]
          16. fp-cancel-sign-sub-invN/A

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

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

            \[\leadsto \color{blue}{\left(-6 \cdot z + 4\right)} \cdot y \]
          19. lower-fma.f6460.1

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

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

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

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

          if -5.49999999999999967e80 < z < -810

          1. Initial program 99.7%

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

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

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

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - z\right), x, x\right)} \]
            5. *-lft-identityN/A

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

              \[\leadsto \mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right), x, x\right) \]
            7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

              if -810 < z < 0.650000000000000022

              1. Initial program 99.3%

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

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

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

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

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

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

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

              if 0.650000000000000022 < z

              1. Initial program 99.8%

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

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

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

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

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

                  \[\leadsto \color{blue}{\left(\left(y - x\right) \cdot z\right)} \cdot -6 \]
                5. lower--.f6495.9

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

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

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

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

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

                Alternative 4: 74.8% accurate, 1.1× speedup?

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

                  1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

                      if -5.49999999999999967e80 < z < -810

                      1. Initial program 99.7%

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

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

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

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

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

                          \[\leadsto \color{blue}{\mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - z\right), x, x\right)} \]
                        5. *-lft-identityN/A

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

                          \[\leadsto \mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right), x, x\right) \]
                        7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                          if -810 < z < 0.650000000000000022

                          1. Initial program 99.3%

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

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

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

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

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

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

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

                        Alternative 5: 97.9% accurate, 1.2× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.54 \lor \neg \left(z \leq 0.6\right):\\ \;\;\;\;\left(-6 \cdot \left(y - x\right)\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\ \end{array} \end{array} \]
                        (FPCore (x y z)
                         :precision binary64
                         (if (or (<= z -0.54) (not (<= z 0.6)))
                           (* (* -6.0 (- y x)) z)
                           (fma -3.0 x (* 4.0 y))))
                        double code(double x, double y, double z) {
                        	double tmp;
                        	if ((z <= -0.54) || !(z <= 0.6)) {
                        		tmp = (-6.0 * (y - x)) * z;
                        	} else {
                        		tmp = fma(-3.0, x, (4.0 * y));
                        	}
                        	return tmp;
                        }
                        
                        function code(x, y, z)
                        	tmp = 0.0
                        	if ((z <= -0.54) || !(z <= 0.6))
                        		tmp = Float64(Float64(-6.0 * Float64(y - x)) * z);
                        	else
                        		tmp = fma(-3.0, x, Float64(4.0 * y));
                        	end
                        	return tmp
                        end
                        
                        code[x_, y_, z_] := If[Or[LessEqual[z, -0.54], N[Not[LessEqual[z, 0.6]], $MachinePrecision]], N[(N[(-6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], N[(-3.0 * x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;z \leq -0.54 \lor \neg \left(z \leq 0.6\right):\\
                        \;\;\;\;\left(-6 \cdot \left(y - x\right)\right) \cdot z\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if z < -0.54000000000000004 or 0.599999999999999978 < z

                          1. Initial program 99.8%

                            \[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
                          2. Add Preprocessing
                          3. 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)} \]
                          4. Applied rewrites99.8%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(y - x, -6 - \frac{-4}{z}, \frac{x}{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. Applied rewrites96.3%

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

                            if -0.54000000000000004 < z < 0.599999999999999978

                            1. Initial program 99.3%

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

                              \[\leadsto \color{blue}{6 \cdot \left(y \cdot \left(\frac{2}{3} - z\right)\right) + x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\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 z around 0

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

                                \[\leadsto x + 4 \cdot \left(y - \color{blue}{1 \cdot x}\right) \]
                              2. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \color{blue}{-3} \cdot x + 4 \cdot y \]
                              13. lower-fma.f64N/A

                                \[\leadsto \color{blue}{\mathsf{fma}\left(-3, x, 4 \cdot y\right)} \]
                              14. lower-*.f6497.7

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

                              \[\leadsto \color{blue}{\mathsf{fma}\left(-3, x, 4 \cdot y\right)} \]
                          7. Recombined 2 regimes into one program.
                          8. Final simplification97.0%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.54 \lor \neg \left(z \leq 0.6\right):\\ \;\;\;\;\left(-6 \cdot \left(y - x\right)\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-3, x, 4 \cdot y\right)\\ \end{array} \]
                          9. Add Preprocessing

                          Alternative 6: 74.4% accurate, 1.3× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -9.6 \cdot 10^{+76} \lor \neg \left(x \leq 7.8 \cdot 10^{+66}\right):\\ \;\;\;\;\mathsf{fma}\left(z, 6, -3\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-6, z, 4\right) \cdot y\\ \end{array} \end{array} \]
                          (FPCore (x y z)
                           :precision binary64
                           (if (or (<= x -9.6e+76) (not (<= x 7.8e+66)))
                             (* (fma z 6.0 -3.0) x)
                             (* (fma -6.0 z 4.0) y)))
                          double code(double x, double y, double z) {
                          	double tmp;
                          	if ((x <= -9.6e+76) || !(x <= 7.8e+66)) {
                          		tmp = fma(z, 6.0, -3.0) * x;
                          	} else {
                          		tmp = fma(-6.0, z, 4.0) * y;
                          	}
                          	return tmp;
                          }
                          
                          function code(x, y, z)
                          	tmp = 0.0
                          	if ((x <= -9.6e+76) || !(x <= 7.8e+66))
                          		tmp = Float64(fma(z, 6.0, -3.0) * x);
                          	else
                          		tmp = Float64(fma(-6.0, z, 4.0) * y);
                          	end
                          	return tmp
                          end
                          
                          code[x_, y_, z_] := If[Or[LessEqual[x, -9.6e+76], N[Not[LessEqual[x, 7.8e+66]], $MachinePrecision]], N[(N[(z * 6.0 + -3.0), $MachinePrecision] * x), $MachinePrecision], N[(N[(-6.0 * z + 4.0), $MachinePrecision] * y), $MachinePrecision]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;x \leq -9.6 \cdot 10^{+76} \lor \neg \left(x \leq 7.8 \cdot 10^{+66}\right):\\
                          \;\;\;\;\mathsf{fma}\left(z, 6, -3\right) \cdot x\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\mathsf{fma}\left(-6, z, 4\right) \cdot y\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if x < -9.5999999999999999e76 or 7.8000000000000007e66 < x

                            1. Initial program 99.5%

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

                              \[\leadsto \color{blue}{6 \cdot \left(y \cdot \left(\frac{2}{3} - z\right)\right) + x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - z\right)\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 inf

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

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

                                \[\leadsto \color{blue}{x \cdot 1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(-6 \cdot \left(\frac{2}{3} - z\right)\right)} \]
                              3. *-rgt-identityN/A

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

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

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

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

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

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

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

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

                                \[\leadsto 1 \cdot x + x \cdot \left(-6 \cdot \left(\frac{2}{3} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right)\right) \]
                              12. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

                            if -9.5999999999999999e76 < x < 7.8000000000000007e66

                            1. Initial program 99.5%

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

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

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

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

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

                                \[\leadsto \left(6 \cdot \left(\frac{2}{3} - \color{blue}{1 \cdot z}\right)\right) \cdot y \]
                              5. metadata-evalN/A

                                \[\leadsto \left(6 \cdot \left(\frac{2}{3} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right)\right) \cdot y \]
                              6. fp-cancel-sign-sub-invN/A

                                \[\leadsto \left(6 \cdot \color{blue}{\left(\frac{2}{3} + -1 \cdot z\right)}\right) \cdot y \]
                              7. distribute-rgt-inN/A

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

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

                                \[\leadsto \color{blue}{\left(4 - \left(\mathsf{neg}\left(-1 \cdot z\right)\right) \cdot 6\right)} \cdot y \]
                              10. distribute-lft-neg-inN/A

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

                                \[\leadsto \left(4 - \left(\color{blue}{1} \cdot z\right) \cdot 6\right) \cdot y \]
                              12. *-lft-identityN/A

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

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

                                \[\leadsto \left(4 - \color{blue}{\left(\mathsf{neg}\left(z \cdot -6\right)\right)}\right) \cdot y \]
                              15. distribute-lft-neg-inN/A

                                \[\leadsto \left(4 - \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot -6}\right) \cdot y \]
                              16. fp-cancel-sign-sub-invN/A

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

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

                                \[\leadsto \color{blue}{\left(-6 \cdot z + 4\right)} \cdot y \]
                              19. lower-fma.f6479.7

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

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

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

                          Alternative 7: 74.7% accurate, 1.3× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -810 \lor \neg \left(z \leq 0.6\right):\\ \;\;\;\;\left(6 \cdot x\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y - x, 4, x\right)\\ \end{array} \end{array} \]
                          (FPCore (x y z)
                           :precision binary64
                           (if (or (<= z -810.0) (not (<= z 0.6))) (* (* 6.0 x) z) (fma (- y x) 4.0 x)))
                          double code(double x, double y, double z) {
                          	double tmp;
                          	if ((z <= -810.0) || !(z <= 0.6)) {
                          		tmp = (6.0 * x) * z;
                          	} else {
                          		tmp = fma((y - x), 4.0, x);
                          	}
                          	return tmp;
                          }
                          
                          function code(x, y, z)
                          	tmp = 0.0
                          	if ((z <= -810.0) || !(z <= 0.6))
                          		tmp = Float64(Float64(6.0 * x) * z);
                          	else
                          		tmp = fma(Float64(y - x), 4.0, x);
                          	end
                          	return tmp
                          end
                          
                          code[x_, y_, z_] := If[Or[LessEqual[z, -810.0], N[Not[LessEqual[z, 0.6]], $MachinePrecision]], N[(N[(6.0 * x), $MachinePrecision] * z), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * 4.0 + x), $MachinePrecision]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;z \leq -810 \lor \neg \left(z \leq 0.6\right):\\
                          \;\;\;\;\left(6 \cdot x\right) \cdot z\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\mathsf{fma}\left(y - x, 4, x\right)\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if z < -810 or 0.599999999999999978 < z

                            1. Initial program 99.8%

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

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

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

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

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

                                \[\leadsto \color{blue}{\mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - z\right), x, x\right)} \]
                              5. *-lft-identityN/A

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

                                \[\leadsto \mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right), x, x\right) \]
                              7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                if -810 < z < 0.599999999999999978

                                1. Initial program 99.3%

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

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

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

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

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

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

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

                                \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -810 \lor \neg \left(z \leq 0.6\right):\\ \;\;\;\;\left(6 \cdot x\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y - x, 4, x\right)\\ \end{array} \]
                              5. Add Preprocessing

                              Alternative 8: 74.7% accurate, 1.3× speedup?

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

                                1. Initial program 99.7%

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

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

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

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

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

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - z\right), x, x\right)} \]
                                  5. *-lft-identityN/A

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

                                    \[\leadsto \mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right), x, x\right) \]
                                  7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    if -810 < z < 0.599999999999999978

                                    1. Initial program 99.3%

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

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

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

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

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

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

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

                                    if 0.599999999999999978 < z

                                    1. Initial program 99.8%

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

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

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

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

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

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - z\right), x, x\right)} \]
                                      5. *-lft-identityN/A

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

                                        \[\leadsto \mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right), x, x\right) \]
                                      7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

                                        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(6, z, -4\right)}, x, x\right) \]
                                    5. Applied rewrites42.9%

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

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

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

                                    Alternative 9: 74.7% accurate, 1.3× speedup?

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

                                      1. Initial program 99.7%

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

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

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

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

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

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - z\right), x, x\right)} \]
                                        5. *-lft-identityN/A

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

                                          \[\leadsto \mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right), x, x\right) \]
                                        7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          if -810 < z < 0.599999999999999978

                                          1. Initial program 99.3%

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

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

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

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

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

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

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

                                          if 0.599999999999999978 < z

                                          1. Initial program 99.8%

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

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

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

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

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

                                              \[\leadsto \color{blue}{\mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - z\right), x, x\right)} \]
                                            5. *-lft-identityN/A

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

                                              \[\leadsto \mathsf{fma}\left(-6 \cdot \left(\frac{2}{3} - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot z\right), x, x\right) \]
                                            7. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

                                              \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(6, z, -4\right)}, x, x\right) \]
                                          5. Applied rewrites42.9%

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

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

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

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

                                            Alternative 10: 37.9% accurate, 1.7× speedup?

                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.12 \cdot 10^{+77} \lor \neg \left(x \leq 1.75 \cdot 10^{-57}\right):\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;4 \cdot y\\ \end{array} \end{array} \]
                                            (FPCore (x y z)
                                             :precision binary64
                                             (if (or (<= x -1.12e+77) (not (<= x 1.75e-57))) (* -3.0 x) (* 4.0 y)))
                                            double code(double x, double y, double z) {
                                            	double tmp;
                                            	if ((x <= -1.12e+77) || !(x <= 1.75e-57)) {
                                            		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 ((x <= (-1.12d+77)) .or. (.not. (x <= 1.75d-57))) 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 ((x <= -1.12e+77) || !(x <= 1.75e-57)) {
                                            		tmp = -3.0 * x;
                                            	} else {
                                            		tmp = 4.0 * y;
                                            	}
                                            	return tmp;
                                            }
                                            
                                            def code(x, y, z):
                                            	tmp = 0
                                            	if (x <= -1.12e+77) or not (x <= 1.75e-57):
                                            		tmp = -3.0 * x
                                            	else:
                                            		tmp = 4.0 * y
                                            	return tmp
                                            
                                            function code(x, y, z)
                                            	tmp = 0.0
                                            	if ((x <= -1.12e+77) || !(x <= 1.75e-57))
                                            		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 ((x <= -1.12e+77) || ~((x <= 1.75e-57)))
                                            		tmp = -3.0 * x;
                                            	else
                                            		tmp = 4.0 * y;
                                            	end
                                            	tmp_2 = tmp;
                                            end
                                            
                                            code[x_, y_, z_] := If[Or[LessEqual[x, -1.12e+77], N[Not[LessEqual[x, 1.75e-57]], $MachinePrecision]], N[(-3.0 * x), $MachinePrecision], N[(4.0 * y), $MachinePrecision]]
                                            
                                            \begin{array}{l}
                                            
                                            \\
                                            \begin{array}{l}
                                            \mathbf{if}\;x \leq -1.12 \cdot 10^{+77} \lor \neg \left(x \leq 1.75 \cdot 10^{-57}\right):\\
                                            \;\;\;\;-3 \cdot x\\
                                            
                                            \mathbf{else}:\\
                                            \;\;\;\;4 \cdot y\\
                                            
                                            
                                            \end{array}
                                            \end{array}
                                            
                                            Derivation
                                            1. Split input into 2 regimes
                                            2. if x < -1.1199999999999999e77 or 1.74999999999999996e-57 < x

                                              1. Initial program 99.6%

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

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

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

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

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

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

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

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

                                                  \[\leadsto -3 \cdot \color{blue}{x} \]

                                                if -1.1199999999999999e77 < x < 1.74999999999999996e-57

                                                1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.12 \cdot 10^{+77} \lor \neg \left(x \leq 1.75 \cdot 10^{-57}\right):\\ \;\;\;\;-3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;4 \cdot y\\ \end{array} \]
                                                10. Add Preprocessing

                                                Alternative 11: 50.8% accurate, 3.1× speedup?

                                                \[\begin{array}{l} \\ \mathsf{fma}\left(y - x, 4, x\right) \end{array} \]
                                                (FPCore (x y z) :precision binary64 (fma (- y x) 4.0 x))
                                                double code(double x, double y, double z) {
                                                	return fma((y - x), 4.0, x);
                                                }
                                                
                                                function code(x, y, z)
                                                	return fma(Float64(y - x), 4.0, x)
                                                end
                                                
                                                code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * 4.0 + x), $MachinePrecision]
                                                
                                                \begin{array}{l}
                                                
                                                \\
                                                \mathsf{fma}\left(y - x, 4, 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. Add Preprocessing
                                                3. Taylor expanded in z around 0

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

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

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

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

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

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

                                                Alternative 12: 27.0% accurate, 5.2× speedup?

                                                \[\begin{array}{l} \\ -3 \cdot x \end{array} \]
                                                (FPCore (x y z) :precision binary64 (* -3.0 x))
                                                double code(double x, double y, double z) {
                                                	return -3.0 * x;
                                                }
                                                
                                                module fmin_fmax_functions
                                                    implicit none
                                                    private
                                                    public fmax
                                                    public fmin
                                                
                                                    interface fmax
                                                        module procedure fmax88
                                                        module procedure fmax44
                                                        module procedure fmax84
                                                        module procedure fmax48
                                                    end interface
                                                    interface fmin
                                                        module procedure fmin88
                                                        module procedure fmin44
                                                        module procedure fmin84
                                                        module procedure fmin48
                                                    end interface
                                                contains
                                                    real(8) function fmax88(x, y) result (res)
                                                        real(8), intent (in) :: x
                                                        real(8), intent (in) :: y
                                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                    end function
                                                    real(4) function fmax44(x, y) result (res)
                                                        real(4), intent (in) :: x
                                                        real(4), intent (in) :: y
                                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                    end function
                                                    real(8) function fmax84(x, y) result(res)
                                                        real(8), intent (in) :: x
                                                        real(4), intent (in) :: y
                                                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                    end function
                                                    real(8) function fmax48(x, y) result(res)
                                                        real(4), intent (in) :: x
                                                        real(8), intent (in) :: y
                                                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                    end function
                                                    real(8) function fmin88(x, y) result (res)
                                                        real(8), intent (in) :: x
                                                        real(8), intent (in) :: y
                                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                    end function
                                                    real(4) function fmin44(x, y) result (res)
                                                        real(4), intent (in) :: x
                                                        real(4), intent (in) :: y
                                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                    end function
                                                    real(8) function fmin84(x, y) result(res)
                                                        real(8), intent (in) :: x
                                                        real(4), intent (in) :: y
                                                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                    end function
                                                    real(8) function fmin48(x, y) result(res)
                                                        real(4), intent (in) :: x
                                                        real(8), intent (in) :: y
                                                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                    end function
                                                end module
                                                
                                                real(8) function code(x, y, z)
                                                use fmin_fmax_functions
                                                    real(8), intent (in) :: x
                                                    real(8), intent (in) :: y
                                                    real(8), intent (in) :: z
                                                    code = (-3.0d0) * x
                                                end function
                                                
                                                public static double code(double x, double y, double z) {
                                                	return -3.0 * x;
                                                }
                                                
                                                def code(x, y, z):
                                                	return -3.0 * x
                                                
                                                function code(x, y, z)
                                                	return Float64(-3.0 * x)
                                                end
                                                
                                                function tmp = code(x, y, z)
                                                	tmp = -3.0 * x;
                                                end
                                                
                                                code[x_, y_, z_] := N[(-3.0 * x), $MachinePrecision]
                                                
                                                \begin{array}{l}
                                                
                                                \\
                                                -3 \cdot x
                                                \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. Add Preprocessing
                                                3. Taylor expanded in z around 0

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

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

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

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

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

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

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

                                                    \[\leadsto -3 \cdot \color{blue}{x} \]
                                                  2. Add Preprocessing

                                                  Reproduce

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