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

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

Specification

?
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
(FPCore (x y z)
 :precision binary64
 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (((y - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z)))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.5% accurate, 1.0× speedup?

\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right) \]
(FPCore (x y z)
 :precision binary64
 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (((y - x) * 6.0d0) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z):
	return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z)
	return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z)))
end
function tmp = code(x, y, z)
	tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)

Alternative 1: 99.8% accurate, 1.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.2% accurate, 1.1× speedup?

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

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

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.55e9 or 1.3e5 < z

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(\mathsf{neg}\left(z\right)\right) \cdot \left(y - x\right)\right) \cdot 6 \]
      8. associate-*r*N/A

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

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

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

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

        \[\leadsto \left(y - x\right) \cdot \left(\mathsf{neg}\left(z \cdot 6\right)\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

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

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

    if -1.55e9 < z < 1.3e5

    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 3: 97.2% accurate, 1.1× speedup?

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

      1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\left(y - x\right) \cdot -6\right) \cdot z \]
        14. lower--.f6450.3%

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

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

      if -1.55e9 < z < 1.3e5

      1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 4: 97.2% accurate, 1.1× speedup?

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

        1. Initial program 99.5%

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

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

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

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

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

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

        if -1.55e9 < z < 1.3e5

        1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 5: 75.0% accurate, 0.9× speedup?

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

          1. Initial program 99.5%

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

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

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

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

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

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

              \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
            6. metadata-eval51.8%

              \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
          4. Applied rewrites51.8%

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

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

              \[\leadsto x \cdot -3 \]
            2. Taylor expanded in z around inf

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

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

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

            if -1.3499999999999999e219 < z < -5e10

            1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(-6 \cdot z\right) \cdot y \]
              6. lower-*.f6426.8%

                \[\leadsto \left(-6 \cdot z\right) \cdot y \]
            11. Applied rewrites26.8%

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

            if -5e10 < z < 1.3e5

            1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if 1.3e5 < z

              1. Initial program 99.5%

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

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

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

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

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

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

                  \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                6. metadata-eval51.8%

                  \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
              4. Applied rewrites51.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto x \cdot \left(1 + \left(-4 - \left(\mathsf{neg}\left(z \cdot 6\right)\right)\right)\right) \]
                15. add-flipN/A

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

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

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

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

                  \[\leadsto -3 \cdot x + \left(6 \cdot z\right) \cdot x \]
                20. associate-*r*N/A

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

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

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

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

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

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

            Alternative 6: 74.9% accurate, 0.9× speedup?

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

              1. Initial program 99.5%

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

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

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

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

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

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

                  \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                6. metadata-eval51.8%

                  \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
              4. Applied rewrites51.8%

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

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

                  \[\leadsto x \cdot -3 \]
                2. Taylor expanded in z around inf

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

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

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

                if -1.3499999999999999e219 < z < -5e10

                1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \left(-6 \cdot z\right) \cdot y \]
                  6. lower-*.f6426.8%

                    \[\leadsto \left(-6 \cdot z\right) \cdot y \]
                11. Applied rewrites26.8%

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

                if -5e10 < z < 1.3e5

                1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if 1.3e5 < z

                  1. Initial program 99.5%

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

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

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

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

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

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

                      \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                    6. metadata-eval51.8%

                      \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
                  4. Applied rewrites51.8%

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

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

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

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

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

                Alternative 7: 49.9% accurate, 0.8× speedup?

                \[\begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{+219}:\\ \;\;\;\;x \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq -9.8 \cdot 10^{-21}:\\ \;\;\;\;\left(-6 \cdot z\right) \cdot y\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{-265}:\\ \;\;\;\;x + 4 \cdot y\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-17}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (if (<= z -1.35e+219)
                   (* x (* 6.0 z))
                   (if (<= z -9.8e-21)
                     (* (* -6.0 z) y)
                     (if (<= z -1.15e-265)
                       (+ x (* 4.0 y))
                       (if (<= z 7.2e-17) (* x -3.0) (* 6.0 (* x z)))))))
                double code(double x, double y, double z) {
                	double tmp;
                	if (z <= -1.35e+219) {
                		tmp = x * (6.0 * z);
                	} else if (z <= -9.8e-21) {
                		tmp = (-6.0 * z) * y;
                	} else if (z <= -1.15e-265) {
                		tmp = x + (4.0 * y);
                	} else if (z <= 7.2e-17) {
                		tmp = x * -3.0;
                	} else {
                		tmp = 6.0 * (x * z);
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x, y, z)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    real(8) :: tmp
                    if (z <= (-1.35d+219)) then
                        tmp = x * (6.0d0 * z)
                    else if (z <= (-9.8d-21)) then
                        tmp = ((-6.0d0) * z) * y
                    else if (z <= (-1.15d-265)) then
                        tmp = x + (4.0d0 * y)
                    else if (z <= 7.2d-17) then
                        tmp = x * (-3.0d0)
                    else
                        tmp = 6.0d0 * (x * z)
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z) {
                	double tmp;
                	if (z <= -1.35e+219) {
                		tmp = x * (6.0 * z);
                	} else if (z <= -9.8e-21) {
                		tmp = (-6.0 * z) * y;
                	} else if (z <= -1.15e-265) {
                		tmp = x + (4.0 * y);
                	} else if (z <= 7.2e-17) {
                		tmp = x * -3.0;
                	} else {
                		tmp = 6.0 * (x * z);
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	tmp = 0
                	if z <= -1.35e+219:
                		tmp = x * (6.0 * z)
                	elif z <= -9.8e-21:
                		tmp = (-6.0 * z) * y
                	elif z <= -1.15e-265:
                		tmp = x + (4.0 * y)
                	elif z <= 7.2e-17:
                		tmp = x * -3.0
                	else:
                		tmp = 6.0 * (x * z)
                	return tmp
                
                function code(x, y, z)
                	tmp = 0.0
                	if (z <= -1.35e+219)
                		tmp = Float64(x * Float64(6.0 * z));
                	elseif (z <= -9.8e-21)
                		tmp = Float64(Float64(-6.0 * z) * y);
                	elseif (z <= -1.15e-265)
                		tmp = Float64(x + Float64(4.0 * y));
                	elseif (z <= 7.2e-17)
                		tmp = Float64(x * -3.0);
                	else
                		tmp = Float64(6.0 * Float64(x * z));
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	tmp = 0.0;
                	if (z <= -1.35e+219)
                		tmp = x * (6.0 * z);
                	elseif (z <= -9.8e-21)
                		tmp = (-6.0 * z) * y;
                	elseif (z <= -1.15e-265)
                		tmp = x + (4.0 * y);
                	elseif (z <= 7.2e-17)
                		tmp = x * -3.0;
                	else
                		tmp = 6.0 * (x * z);
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := If[LessEqual[z, -1.35e+219], N[(x * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.8e-21], N[(N[(-6.0 * z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, -1.15e-265], N[(x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e-17], N[(x * -3.0), $MachinePrecision], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]
                
                \begin{array}{l}
                \mathbf{if}\;z \leq -1.35 \cdot 10^{+219}:\\
                \;\;\;\;x \cdot \left(6 \cdot z\right)\\
                
                \mathbf{elif}\;z \leq -9.8 \cdot 10^{-21}:\\
                \;\;\;\;\left(-6 \cdot z\right) \cdot y\\
                
                \mathbf{elif}\;z \leq -1.15 \cdot 10^{-265}:\\
                \;\;\;\;x + 4 \cdot y\\
                
                \mathbf{elif}\;z \leq 7.2 \cdot 10^{-17}:\\
                \;\;\;\;x \cdot -3\\
                
                \mathbf{else}:\\
                \;\;\;\;6 \cdot \left(x \cdot z\right)\\
                
                
                \end{array}
                
                Derivation
                1. Split input into 5 regimes
                2. if z < -1.3499999999999999e219

                  1. Initial program 99.5%

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

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

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

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

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

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

                      \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                    6. metadata-eval51.8%

                      \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
                  4. Applied rewrites51.8%

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

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

                      \[\leadsto x \cdot -3 \]
                    2. Taylor expanded in z around inf

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

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

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

                    if -1.3499999999999999e219 < z < -9.8000000000000003e-21

                    1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left(-6 \cdot z\right) \cdot y \]
                      6. lower-*.f6426.8%

                        \[\leadsto \left(-6 \cdot z\right) \cdot y \]
                    11. Applied rewrites26.8%

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

                    if -9.8000000000000003e-21 < z < -1.1499999999999999e-265

                    1. Initial program 99.5%

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

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

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

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

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

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

                        \[\leadsto x + 4 \cdot y \]

                      if -1.1499999999999999e-265 < z < 7.1999999999999999e-17

                      1. Initial program 99.5%

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

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

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

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

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

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

                          \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                        6. metadata-eval51.8%

                          \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
                      4. Applied rewrites51.8%

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

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

                          \[\leadsto x \cdot -3 \]

                        if 7.1999999999999999e-17 < z

                        1. Initial program 99.5%

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

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

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

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

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

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

                            \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                          6. metadata-eval51.8%

                            \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
                        4. Applied rewrites51.8%

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

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

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

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

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

                      Alternative 8: 49.6% accurate, 0.8× speedup?

                      \[\begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{+219}:\\ \;\;\;\;x \cdot \left(6 \cdot z\right)\\ \mathbf{elif}\;z \leq -9.8 \cdot 10^{-21}:\\ \;\;\;\;-6 \cdot \left(y \cdot z\right)\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{-265}:\\ \;\;\;\;x + 4 \cdot y\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-17}:\\ \;\;\;\;x \cdot -3\\ \mathbf{else}:\\ \;\;\;\;6 \cdot \left(x \cdot z\right)\\ \end{array} \]
                      (FPCore (x y z)
                       :precision binary64
                       (if (<= z -1.35e+219)
                         (* x (* 6.0 z))
                         (if (<= z -9.8e-21)
                           (* -6.0 (* y z))
                           (if (<= z -1.15e-265)
                             (+ x (* 4.0 y))
                             (if (<= z 7.2e-17) (* x -3.0) (* 6.0 (* x z)))))))
                      double code(double x, double y, double z) {
                      	double tmp;
                      	if (z <= -1.35e+219) {
                      		tmp = x * (6.0 * z);
                      	} else if (z <= -9.8e-21) {
                      		tmp = -6.0 * (y * z);
                      	} else if (z <= -1.15e-265) {
                      		tmp = x + (4.0 * y);
                      	} else if (z <= 7.2e-17) {
                      		tmp = x * -3.0;
                      	} else {
                      		tmp = 6.0 * (x * z);
                      	}
                      	return tmp;
                      }
                      
                      module fmin_fmax_functions
                          implicit none
                          private
                          public fmax
                          public fmin
                      
                          interface fmax
                              module procedure fmax88
                              module procedure fmax44
                              module procedure fmax84
                              module procedure fmax48
                          end interface
                          interface fmin
                              module procedure fmin88
                              module procedure fmin44
                              module procedure fmin84
                              module procedure fmin48
                          end interface
                      contains
                          real(8) function fmax88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmax44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmax84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmax48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                          end function
                          real(8) function fmin88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmin44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmin84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmin48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                          end function
                      end module
                      
                      real(8) function code(x, y, z)
                      use fmin_fmax_functions
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          real(8), intent (in) :: z
                          real(8) :: tmp
                          if (z <= (-1.35d+219)) then
                              tmp = x * (6.0d0 * z)
                          else if (z <= (-9.8d-21)) then
                              tmp = (-6.0d0) * (y * z)
                          else if (z <= (-1.15d-265)) then
                              tmp = x + (4.0d0 * y)
                          else if (z <= 7.2d-17) then
                              tmp = x * (-3.0d0)
                          else
                              tmp = 6.0d0 * (x * z)
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double x, double y, double z) {
                      	double tmp;
                      	if (z <= -1.35e+219) {
                      		tmp = x * (6.0 * z);
                      	} else if (z <= -9.8e-21) {
                      		tmp = -6.0 * (y * z);
                      	} else if (z <= -1.15e-265) {
                      		tmp = x + (4.0 * y);
                      	} else if (z <= 7.2e-17) {
                      		tmp = x * -3.0;
                      	} else {
                      		tmp = 6.0 * (x * z);
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y, z):
                      	tmp = 0
                      	if z <= -1.35e+219:
                      		tmp = x * (6.0 * z)
                      	elif z <= -9.8e-21:
                      		tmp = -6.0 * (y * z)
                      	elif z <= -1.15e-265:
                      		tmp = x + (4.0 * y)
                      	elif z <= 7.2e-17:
                      		tmp = x * -3.0
                      	else:
                      		tmp = 6.0 * (x * z)
                      	return tmp
                      
                      function code(x, y, z)
                      	tmp = 0.0
                      	if (z <= -1.35e+219)
                      		tmp = Float64(x * Float64(6.0 * z));
                      	elseif (z <= -9.8e-21)
                      		tmp = Float64(-6.0 * Float64(y * z));
                      	elseif (z <= -1.15e-265)
                      		tmp = Float64(x + Float64(4.0 * y));
                      	elseif (z <= 7.2e-17)
                      		tmp = Float64(x * -3.0);
                      	else
                      		tmp = Float64(6.0 * Float64(x * z));
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(x, y, z)
                      	tmp = 0.0;
                      	if (z <= -1.35e+219)
                      		tmp = x * (6.0 * z);
                      	elseif (z <= -9.8e-21)
                      		tmp = -6.0 * (y * z);
                      	elseif (z <= -1.15e-265)
                      		tmp = x + (4.0 * y);
                      	elseif (z <= 7.2e-17)
                      		tmp = x * -3.0;
                      	else
                      		tmp = 6.0 * (x * z);
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[x_, y_, z_] := If[LessEqual[z, -1.35e+219], N[(x * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.8e-21], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.15e-265], N[(x + N[(4.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e-17], N[(x * -3.0), $MachinePrecision], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]
                      
                      \begin{array}{l}
                      \mathbf{if}\;z \leq -1.35 \cdot 10^{+219}:\\
                      \;\;\;\;x \cdot \left(6 \cdot z\right)\\
                      
                      \mathbf{elif}\;z \leq -9.8 \cdot 10^{-21}:\\
                      \;\;\;\;-6 \cdot \left(y \cdot z\right)\\
                      
                      \mathbf{elif}\;z \leq -1.15 \cdot 10^{-265}:\\
                      \;\;\;\;x + 4 \cdot y\\
                      
                      \mathbf{elif}\;z \leq 7.2 \cdot 10^{-17}:\\
                      \;\;\;\;x \cdot -3\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;6 \cdot \left(x \cdot z\right)\\
                      
                      
                      \end{array}
                      
                      Derivation
                      1. Split input into 5 regimes
                      2. if z < -1.3499999999999999e219

                        1. Initial program 99.5%

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

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

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

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

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

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

                            \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                          6. metadata-eval51.8%

                            \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
                        4. Applied rewrites51.8%

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

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

                            \[\leadsto x \cdot -3 \]
                          2. Taylor expanded in z around inf

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

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

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

                          if -1.3499999999999999e219 < z < -9.8000000000000003e-21

                          1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          if -9.8000000000000003e-21 < z < -1.1499999999999999e-265

                          1. Initial program 99.5%

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

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

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

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

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

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

                              \[\leadsto x + 4 \cdot y \]

                            if -1.1499999999999999e-265 < z < 7.1999999999999999e-17

                            1. Initial program 99.5%

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

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

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

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

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

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

                                \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                              6. metadata-eval51.8%

                                \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
                            4. Applied rewrites51.8%

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

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

                                \[\leadsto x \cdot -3 \]

                              if 7.1999999999999999e-17 < z

                              1. Initial program 99.5%

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

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

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

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

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

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

                                  \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                                6. metadata-eval51.8%

                                  \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
                              4. Applied rewrites51.8%

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

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

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

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

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

                            Alternative 9: 49.6% accurate, 1.0× speedup?

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

                              1. Initial program 99.5%

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

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

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

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

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

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

                                  \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                                6. metadata-eval51.8%

                                  \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
                              4. Applied rewrites51.8%

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

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

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

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

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

                              if -9.8000000000000003e-21 < z < -1.1499999999999999e-265

                              1. Initial program 99.5%

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

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

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

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

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

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

                                  \[\leadsto x + 4 \cdot y \]

                                if -1.1499999999999999e-265 < z < 7.1999999999999999e-17

                                1. Initial program 99.5%

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

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

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

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

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

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

                                    \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                                  6. metadata-eval51.8%

                                    \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
                                4. Applied rewrites51.8%

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

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

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

                                Alternative 10: 37.3% accurate, 1.3× speedup?

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

                                  1. Initial program 99.5%

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

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

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

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

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

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

                                      \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                                    6. metadata-eval51.8%

                                      \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
                                  4. Applied rewrites51.8%

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

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

                                      \[\leadsto x \cdot -3 \]

                                    if -1.1e-83 < x < 8.7999999999999996e-101

                                    1. Initial program 99.5%

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

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

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

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

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

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

                                        \[\leadsto x + 4 \cdot y \]
                                    7. Recombined 2 regimes into one program.
                                    8. Add Preprocessing

                                    Alternative 11: 26.1% accurate, 4.7× speedup?

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

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

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

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

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

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

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

                                        \[\leadsto x \cdot \left(1 + -6 \cdot \left(\frac{2}{3} - \color{blue}{z}\right)\right) \]
                                      6. metadata-eval51.8%

                                        \[\leadsto x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) \]
                                    4. Applied rewrites51.8%

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

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

                                        \[\leadsto x \cdot -3 \]
                                      2. Add Preprocessing

                                      Reproduce

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