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

Percentage Accurate: 99.7% → 99.7%
Time: 2.9s
Alternatives: 9
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 99.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 1.0× speedup?

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

\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
Derivation
  1. Initial program 99.8%

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

Alternative 2: 60.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.15 \cdot 10^{-112}:\\ \;\;\;\;\left(z \cdot 6\right) \cdot y\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-44}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.16 \cdot 10^{+154}:\\ \;\;\;\;\left(6 \cdot y\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;\left(-6 \cdot x\right) \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -3.15e-112)
   (* (* z 6.0) y)
   (if (<= z 6.6e-44)
     x
     (if (<= z 1.16e+154) (* (* 6.0 y) z) (* (* -6.0 x) z)))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -3.15e-112) {
		tmp = (z * 6.0) * y;
	} else if (z <= 6.6e-44) {
		tmp = x;
	} else if (z <= 1.16e+154) {
		tmp = (6.0 * y) * z;
	} 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 <= (-3.15d-112)) then
        tmp = (z * 6.0d0) * y
    else if (z <= 6.6d-44) then
        tmp = x
    else if (z <= 1.16d+154) then
        tmp = (6.0d0 * y) * z
    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 <= -3.15e-112) {
		tmp = (z * 6.0) * y;
	} else if (z <= 6.6e-44) {
		tmp = x;
	} else if (z <= 1.16e+154) {
		tmp = (6.0 * y) * z;
	} else {
		tmp = (-6.0 * x) * z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -3.15e-112:
		tmp = (z * 6.0) * y
	elif z <= 6.6e-44:
		tmp = x
	elif z <= 1.16e+154:
		tmp = (6.0 * y) * z
	else:
		tmp = (-6.0 * x) * z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -3.15e-112)
		tmp = Float64(Float64(z * 6.0) * y);
	elseif (z <= 6.6e-44)
		tmp = x;
	elseif (z <= 1.16e+154)
		tmp = Float64(Float64(6.0 * y) * z);
	else
		tmp = Float64(Float64(-6.0 * x) * z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -3.15e-112)
		tmp = (z * 6.0) * y;
	elseif (z <= 6.6e-44)
		tmp = x;
	elseif (z <= 1.16e+154)
		tmp = (6.0 * y) * z;
	else
		tmp = (-6.0 * x) * z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -3.15e-112], N[(N[(z * 6.0), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 6.6e-44], x, If[LessEqual[z, 1.16e+154], N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision], N[(N[(-6.0 * x), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.15 \cdot 10^{-112}:\\
\;\;\;\;\left(z \cdot 6\right) \cdot y\\

\mathbf{elif}\;z \leq 6.6 \cdot 10^{-44}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.16 \cdot 10^{+154}:\\
\;\;\;\;\left(6 \cdot y\right) \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -3.15000000000000008e-112

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \left(z \cdot y\right) \cdot 6 \]
      4. lower-*.f6459.2

        \[\leadsto \left(z \cdot y\right) \cdot 6 \]
    5. Applied rewrites59.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left(z \cdot 6\right) \cdot y \]
      9. lower-*.f6459.3

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

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

    if -3.15000000000000008e-112 < z < 6.60000000000000011e-44

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x} \]
    4. Step-by-step derivation
      1. Applied rewrites76.0%

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

      if 6.60000000000000011e-44 < z < 1.16000000000000001e154

      1. Initial program 99.7%

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

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

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

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

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

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

          \[\leadsto \left(\left(y - x\right) \cdot 6\right) \cdot z \]
        6. lift-*.f6491.8

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

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

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

          \[\leadsto \left(6 \cdot y\right) \cdot z \]
      8. Applied rewrites65.0%

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

      if 1.16000000000000001e154 < z

      1. Initial program 99.9%

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

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

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

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

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

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

          \[\leadsto \left(\left(y - x\right) \cdot 6\right) \cdot z \]
        6. lift-*.f6499.9

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

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

        \[\leadsto \left(-6 \cdot x\right) \cdot z \]
      7. Step-by-step derivation
        1. lower-*.f6480.5

          \[\leadsto \left(-6 \cdot x\right) \cdot z \]
      8. Applied rewrites80.5%

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

    Alternative 3: 60.5% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(6 \cdot y\right) \cdot z\\ \mathbf{if}\;z \leq -3.15 \cdot 10^{-112}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-44}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.16 \cdot 10^{+154}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(-6 \cdot x\right) \cdot z\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (* (* 6.0 y) z)))
       (if (<= z -3.15e-112)
         t_0
         (if (<= z 6.6e-44) x (if (<= z 1.16e+154) t_0 (* (* -6.0 x) z))))))
    double code(double x, double y, double z) {
    	double t_0 = (6.0 * y) * z;
    	double tmp;
    	if (z <= -3.15e-112) {
    		tmp = t_0;
    	} else if (z <= 6.6e-44) {
    		tmp = x;
    	} else if (z <= 1.16e+154) {
    		tmp = t_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) :: t_0
        real(8) :: tmp
        t_0 = (6.0d0 * y) * z
        if (z <= (-3.15d-112)) then
            tmp = t_0
        else if (z <= 6.6d-44) then
            tmp = x
        else if (z <= 1.16d+154) then
            tmp = t_0
        else
            tmp = ((-6.0d0) * x) * z
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double t_0 = (6.0 * y) * z;
    	double tmp;
    	if (z <= -3.15e-112) {
    		tmp = t_0;
    	} else if (z <= 6.6e-44) {
    		tmp = x;
    	} else if (z <= 1.16e+154) {
    		tmp = t_0;
    	} else {
    		tmp = (-6.0 * x) * z;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = (6.0 * y) * z
    	tmp = 0
    	if z <= -3.15e-112:
    		tmp = t_0
    	elif z <= 6.6e-44:
    		tmp = x
    	elif z <= 1.16e+154:
    		tmp = t_0
    	else:
    		tmp = (-6.0 * x) * z
    	return tmp
    
    function code(x, y, z)
    	t_0 = Float64(Float64(6.0 * y) * z)
    	tmp = 0.0
    	if (z <= -3.15e-112)
    		tmp = t_0;
    	elseif (z <= 6.6e-44)
    		tmp = x;
    	elseif (z <= 1.16e+154)
    		tmp = t_0;
    	else
    		tmp = Float64(Float64(-6.0 * x) * z);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	t_0 = (6.0 * y) * z;
    	tmp = 0.0;
    	if (z <= -3.15e-112)
    		tmp = t_0;
    	elseif (z <= 6.6e-44)
    		tmp = x;
    	elseif (z <= 1.16e+154)
    		tmp = t_0;
    	else
    		tmp = (-6.0 * x) * z;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -3.15e-112], t$95$0, If[LessEqual[z, 6.6e-44], x, If[LessEqual[z, 1.16e+154], t$95$0, N[(N[(-6.0 * x), $MachinePrecision] * z), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \left(6 \cdot y\right) \cdot z\\
    \mathbf{if}\;z \leq -3.15 \cdot 10^{-112}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;z \leq 6.6 \cdot 10^{-44}:\\
    \;\;\;\;x\\
    
    \mathbf{elif}\;z \leq 1.16 \cdot 10^{+154}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(-6 \cdot x\right) \cdot z\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z < -3.15000000000000008e-112 or 6.60000000000000011e-44 < z < 1.16000000000000001e154

      1. Initial program 99.8%

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

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

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

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

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

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

          \[\leadsto \left(\left(y - x\right) \cdot 6\right) \cdot z \]
        6. lift-*.f6487.1

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

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

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

          \[\leadsto \left(6 \cdot y\right) \cdot z \]
      8. Applied rewrites61.2%

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

      if -3.15000000000000008e-112 < z < 6.60000000000000011e-44

      1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x} \]
      4. Step-by-step derivation
        1. Applied rewrites76.0%

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

        if 1.16000000000000001e154 < z

        1. Initial program 99.9%

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

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

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

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

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

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

            \[\leadsto \left(\left(y - x\right) \cdot 6\right) \cdot z \]
          6. lift-*.f6499.9

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

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

          \[\leadsto \left(-6 \cdot x\right) \cdot z \]
        7. Step-by-step derivation
          1. lower-*.f6480.5

            \[\leadsto \left(-6 \cdot x\right) \cdot z \]
        8. Applied rewrites80.5%

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

      Alternative 4: 98.9% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 0.165\right):\\ \;\;\;\;\left(\left(y - x\right) \cdot 6\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot 6\right) \cdot z\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (or (<= z -0.165) (not (<= z 0.165)))
         (* (* (- y x) 6.0) z)
         (+ x (* (* y 6.0) z))))
      double code(double x, double y, double z) {
      	double tmp;
      	if ((z <= -0.165) || !(z <= 0.165)) {
      		tmp = ((y - x) * 6.0) * z;
      	} else {
      		tmp = x + ((y * 6.0) * 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 <= (-0.165d0)) .or. (.not. (z <= 0.165d0))) then
              tmp = ((y - x) * 6.0d0) * z
          else
              tmp = x + ((y * 6.0d0) * z)
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double tmp;
      	if ((z <= -0.165) || !(z <= 0.165)) {
      		tmp = ((y - x) * 6.0) * z;
      	} else {
      		tmp = x + ((y * 6.0) * z);
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	tmp = 0
      	if (z <= -0.165) or not (z <= 0.165):
      		tmp = ((y - x) * 6.0) * z
      	else:
      		tmp = x + ((y * 6.0) * z)
      	return tmp
      
      function code(x, y, z)
      	tmp = 0.0
      	if ((z <= -0.165) || !(z <= 0.165))
      		tmp = Float64(Float64(Float64(y - x) * 6.0) * z);
      	else
      		tmp = Float64(x + Float64(Float64(y * 6.0) * z));
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	tmp = 0.0;
      	if ((z <= -0.165) || ~((z <= 0.165)))
      		tmp = ((y - x) * 6.0) * z;
      	else
      		tmp = x + ((y * 6.0) * z);
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := If[Or[LessEqual[z, -0.165], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision], N[(x + N[(N[(y * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 0.165\right):\\
      \;\;\;\;\left(\left(y - x\right) \cdot 6\right) \cdot z\\
      
      \mathbf{else}:\\
      \;\;\;\;x + \left(y \cdot 6\right) \cdot z\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < -0.165000000000000008 or 0.165000000000000008 < z

        1. Initial program 99.8%

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

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

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

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

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

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

            \[\leadsto \left(\left(y - x\right) \cdot 6\right) \cdot z \]
          6. lift-*.f6498.6

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

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

        if -0.165000000000000008 < z < 0.165000000000000008

        1. Initial program 99.9%

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

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

            \[\leadsto x + \left(\color{blue}{y} \cdot 6\right) \cdot z \]
        5. Recombined 2 regimes into one program.
        6. Final simplification97.9%

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

        Alternative 5: 98.9% accurate, 0.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.15 \lor \neg \left(z \leq 0.165\right):\\ \;\;\;\;\left(\left(y - x\right) \cdot 6\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \left(6 \cdot z\right) \cdot y\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (or (<= z -0.15) (not (<= z 0.165)))
           (* (* (- y x) 6.0) z)
           (+ x (* (* 6.0 z) y))))
        double code(double x, double y, double z) {
        	double tmp;
        	if ((z <= -0.15) || !(z <= 0.165)) {
        		tmp = ((y - x) * 6.0) * z;
        	} else {
        		tmp = x + ((6.0 * z) * y);
        	}
        	return tmp;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(x, y, z)
        use fmin_fmax_functions
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8) :: tmp
            if ((z <= (-0.15d0)) .or. (.not. (z <= 0.165d0))) then
                tmp = ((y - x) * 6.0d0) * z
            else
                tmp = x + ((6.0d0 * z) * y)
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if ((z <= -0.15) || !(z <= 0.165)) {
        		tmp = ((y - x) * 6.0) * z;
        	} else {
        		tmp = x + ((6.0 * z) * y);
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if (z <= -0.15) or not (z <= 0.165):
        		tmp = ((y - x) * 6.0) * z
        	else:
        		tmp = x + ((6.0 * z) * y)
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if ((z <= -0.15) || !(z <= 0.165))
        		tmp = Float64(Float64(Float64(y - x) * 6.0) * z);
        	else
        		tmp = Float64(x + Float64(Float64(6.0 * z) * y));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if ((z <= -0.15) || ~((z <= 0.165)))
        		tmp = ((y - x) * 6.0) * z;
        	else
        		tmp = x + ((6.0 * z) * y);
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[Or[LessEqual[z, -0.15], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision], N[(x + N[(N[(6.0 * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -0.15 \lor \neg \left(z \leq 0.165\right):\\
        \;\;\;\;\left(\left(y - x\right) \cdot 6\right) \cdot z\\
        
        \mathbf{else}:\\
        \;\;\;\;x + \left(6 \cdot z\right) \cdot y\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -0.149999999999999994 or 0.165000000000000008 < z

          1. Initial program 99.8%

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

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

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

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

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

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

              \[\leadsto \left(\left(y - x\right) \cdot 6\right) \cdot z \]
            6. lift-*.f6498.6

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

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

          if -0.149999999999999994 < z < 0.165000000000000008

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

              \[\leadsto x + \color{blue}{\left(6 \cdot z\right) \cdot y} \]
          5. Recombined 2 regimes into one program.
          6. Final simplification97.9%

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

          Alternative 6: 98.8% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.175 \lor \neg \left(z \leq 2600000\right):\\ \;\;\;\;\left(\left(y - x\right) \cdot 6\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + \left(z \cdot y\right) \cdot 6\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (or (<= z -0.175) (not (<= z 2600000.0)))
             (* (* (- y x) 6.0) z)
             (+ x (* (* z y) 6.0))))
          double code(double x, double y, double z) {
          	double tmp;
          	if ((z <= -0.175) || !(z <= 2600000.0)) {
          		tmp = ((y - x) * 6.0) * z;
          	} else {
          		tmp = x + ((z * y) * 6.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 ((z <= (-0.175d0)) .or. (.not. (z <= 2600000.0d0))) then
                  tmp = ((y - x) * 6.0d0) * z
              else
                  tmp = x + ((z * y) * 6.0d0)
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z) {
          	double tmp;
          	if ((z <= -0.175) || !(z <= 2600000.0)) {
          		tmp = ((y - x) * 6.0) * z;
          	} else {
          		tmp = x + ((z * y) * 6.0);
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	tmp = 0
          	if (z <= -0.175) or not (z <= 2600000.0):
          		tmp = ((y - x) * 6.0) * z
          	else:
          		tmp = x + ((z * y) * 6.0)
          	return tmp
          
          function code(x, y, z)
          	tmp = 0.0
          	if ((z <= -0.175) || !(z <= 2600000.0))
          		tmp = Float64(Float64(Float64(y - x) * 6.0) * z);
          	else
          		tmp = Float64(x + Float64(Float64(z * y) * 6.0));
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	tmp = 0.0;
          	if ((z <= -0.175) || ~((z <= 2600000.0)))
          		tmp = ((y - x) * 6.0) * z;
          	else
          		tmp = x + ((z * y) * 6.0);
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := If[Or[LessEqual[z, -0.175], N[Not[LessEqual[z, 2600000.0]], $MachinePrecision]], N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;z \leq -0.175 \lor \neg \left(z \leq 2600000\right):\\
          \;\;\;\;\left(\left(y - x\right) \cdot 6\right) \cdot z\\
          
          \mathbf{else}:\\
          \;\;\;\;x + \left(z \cdot y\right) \cdot 6\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z < -0.17499999999999999 or 2.6e6 < z

            1. Initial program 99.8%

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

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

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

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

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

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

                \[\leadsto \left(\left(y - x\right) \cdot 6\right) \cdot z \]
              6. lift-*.f6498.6

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

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

            if -0.17499999999999999 < z < 2.6e6

            1. Initial program 99.9%

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

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

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

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

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

                \[\leadsto x + \left(-6 \cdot z - -6 \cdot \frac{y \cdot z}{x}\right) \cdot x \]
              5. distribute-lft-out--N/A

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

                \[\leadsto x + \left(-6 \cdot \left(z - \frac{y \cdot z}{x}\right)\right) \cdot x \]
              7. lower--.f64N/A

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

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

                \[\leadsto x + \left(-6 \cdot \left(z - \frac{z \cdot y}{x}\right)\right) \cdot x \]
              10. lower-*.f6496.0

                \[\leadsto x + \left(-6 \cdot \left(z - \frac{z \cdot y}{x}\right)\right) \cdot x \]
            5. Applied rewrites96.0%

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

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

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

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

                \[\leadsto x + \left(z \cdot y\right) \cdot \color{blue}{6} \]
              4. lift-*.f6497.3

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

              \[\leadsto x + \color{blue}{\left(z \cdot y\right) \cdot 6} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification97.9%

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

          Alternative 7: 83.5% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -3.15 \cdot 10^{-112} \lor \neg \left(z \leq 6.6 \cdot 10^{-44}\right):\\ \;\;\;\;\left(\left(y - x\right) \cdot 6\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (or (<= z -3.15e-112) (not (<= z 6.6e-44))) (* (* (- y x) 6.0) z) x))
          double code(double x, double y, double z) {
          	double tmp;
          	if ((z <= -3.15e-112) || !(z <= 6.6e-44)) {
          		tmp = ((y - x) * 6.0) * z;
          	} else {
          		tmp = x;
          	}
          	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 <= (-3.15d-112)) .or. (.not. (z <= 6.6d-44))) then
                  tmp = ((y - x) * 6.0d0) * z
              else
                  tmp = x
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z) {
          	double tmp;
          	if ((z <= -3.15e-112) || !(z <= 6.6e-44)) {
          		tmp = ((y - x) * 6.0) * z;
          	} else {
          		tmp = x;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	tmp = 0
          	if (z <= -3.15e-112) or not (z <= 6.6e-44):
          		tmp = ((y - x) * 6.0) * z
          	else:
          		tmp = x
          	return tmp
          
          function code(x, y, z)
          	tmp = 0.0
          	if ((z <= -3.15e-112) || !(z <= 6.6e-44))
          		tmp = Float64(Float64(Float64(y - x) * 6.0) * z);
          	else
          		tmp = x;
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	tmp = 0.0;
          	if ((z <= -3.15e-112) || ~((z <= 6.6e-44)))
          		tmp = ((y - x) * 6.0) * z;
          	else
          		tmp = x;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := If[Or[LessEqual[z, -3.15e-112], N[Not[LessEqual[z, 6.6e-44]], $MachinePrecision]], N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision], x]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;z \leq -3.15 \cdot 10^{-112} \lor \neg \left(z \leq 6.6 \cdot 10^{-44}\right):\\
          \;\;\;\;\left(\left(y - x\right) \cdot 6\right) \cdot z\\
          
          \mathbf{else}:\\
          \;\;\;\;x\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z < -3.15000000000000008e-112 or 6.60000000000000011e-44 < z

            1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

            if -3.15000000000000008e-112 < z < 6.60000000000000011e-44

            1. Initial program 99.9%

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

              \[\leadsto \color{blue}{x} \]
            4. Step-by-step derivation
              1. Applied rewrites76.0%

                \[\leadsto \color{blue}{x} \]
            5. Recombined 2 regimes into one program.
            6. Final simplification85.0%

              \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.15 \cdot 10^{-112} \lor \neg \left(z \leq 6.6 \cdot 10^{-44}\right):\\ \;\;\;\;\left(\left(y - x\right) \cdot 6\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
            7. Add Preprocessing

            Alternative 8: 61.3% accurate, 0.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 0.165\right):\\ \;\;\;\;\left(-6 \cdot x\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (or (<= z -0.165) (not (<= z 0.165))) (* (* -6.0 x) z) x))
            double code(double x, double y, double z) {
            	double tmp;
            	if ((z <= -0.165) || !(z <= 0.165)) {
            		tmp = (-6.0 * x) * z;
            	} else {
            		tmp = x;
            	}
            	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 <= (-0.165d0)) .or. (.not. (z <= 0.165d0))) then
                    tmp = ((-6.0d0) * x) * z
                else
                    tmp = x
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double tmp;
            	if ((z <= -0.165) || !(z <= 0.165)) {
            		tmp = (-6.0 * x) * z;
            	} else {
            		tmp = x;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	tmp = 0
            	if (z <= -0.165) or not (z <= 0.165):
            		tmp = (-6.0 * x) * z
            	else:
            		tmp = x
            	return tmp
            
            function code(x, y, z)
            	tmp = 0.0
            	if ((z <= -0.165) || !(z <= 0.165))
            		tmp = Float64(Float64(-6.0 * x) * z);
            	else
            		tmp = x;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	tmp = 0.0;
            	if ((z <= -0.165) || ~((z <= 0.165)))
            		tmp = (-6.0 * x) * z;
            	else
            		tmp = x;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := If[Or[LessEqual[z, -0.165], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(N[(-6.0 * x), $MachinePrecision] * z), $MachinePrecision], x]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 0.165\right):\\
            \;\;\;\;\left(-6 \cdot x\right) \cdot z\\
            
            \mathbf{else}:\\
            \;\;\;\;x\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z < -0.165000000000000008 or 0.165000000000000008 < z

              1. Initial program 99.8%

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

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

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

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

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

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

                  \[\leadsto \left(\left(y - x\right) \cdot 6\right) \cdot z \]
                6. lift-*.f6498.6

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

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

                \[\leadsto \left(-6 \cdot x\right) \cdot z \]
              7. Step-by-step derivation
                1. lower-*.f6451.4

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

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

              if -0.165000000000000008 < z < 0.165000000000000008

              1. Initial program 99.9%

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

                \[\leadsto \color{blue}{x} \]
              4. Step-by-step derivation
                1. Applied rewrites62.5%

                  \[\leadsto \color{blue}{x} \]
              5. Recombined 2 regimes into one program.
              6. Final simplification56.7%

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

              Alternative 9: 36.6% accurate, 17.0× speedup?

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

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

                \[\leadsto \color{blue}{x} \]
              4. Step-by-step derivation
                1. Applied rewrites31.3%

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

                Reproduce

                ?
                herbie shell --seed 2025065 
                (FPCore (x y z)
                  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
                  :precision binary64
                
                  :alt
                  (! :herbie-platform default (- x (* (* 6 z) (- x y))))
                
                  (+ x (* (* (- y x) 6.0) z)))