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

Percentage Accurate: 99.7% → 100.0%
Time: 45.0s
Alternatives: 12
Speedup: 1.0×

Specification

?
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
(FPCore (x y z)
  :precision binary64
  (+ x (* (* (- y x) 6) 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), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot z

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 99.7% accurate, 1.0× speedup?

\[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
(FPCore (x y z)
  :precision binary64
  (+ x (* (* (- y x) 6) 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), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot z

Alternative 1: 100.0% accurate, 0.7× speedup?

\[x + \mathsf{134\_z0z1z2z3z4}\left(z, y, 6, x, 6\right) \]
(FPCore (x y z)
  :precision binary64
  (+ x (134-z0z1z2z3z4 z y 6 x 6)))
x + \mathsf{134\_z0z1z2z3z4}\left(z, y, 6, x, 6\right)
Derivation
  1. Initial program 99.7%

    \[x + \left(\left(y - x\right) \cdot 6\right) \cdot z \]
  2. Step-by-step derivation
    1. remove-double-negN/A

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

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

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

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

      \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) \cdot \left(\left(y - x\right) \cdot 6\right)} \]
    6. remove-double-negN/A

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

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

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

      \[\leadsto x + z \cdot \left(6 \cdot \color{blue}{\left(y - x\right)}\right) \]
    10. distribute-rgt-out--N/A

      \[\leadsto x + z \cdot \color{blue}{\left(y \cdot 6 - x \cdot 6\right)} \]
    11. lower-134-z0z1z2z3z4100.0%

      \[\leadsto x + \color{blue}{\mathsf{134\_z0z1z2z3z4}\left(z, y, 6, x, 6\right)} \]
  3. Applied rewrites100.0%

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

Alternative 2: 98.5% accurate, 0.7× speedup?

\[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq -49000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq \frac{3961408125713217}{2475880078570760549798248448}:\\ \;\;\;\;x + \left(y \cdot 6\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (let* ((t_0 (* 6 (* z (- y x)))))
  (if (<= z -49000)
    t_0
    (if (<= z 3961408125713217/2475880078570760549798248448)
      (+ x (* (* y 6) z))
      t_0))))
double code(double x, double y, double z) {
	double t_0 = 6.0 * (z * (y - x));
	double tmp;
	if (z <= -49000.0) {
		tmp = t_0;
	} else if (z <= 1.6e-12) {
		tmp = x + ((y * 6.0) * z);
	} else {
		tmp = t_0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 6.0d0 * (z * (y - x))
    if (z <= (-49000.0d0)) then
        tmp = t_0
    else if (z <= 1.6d-12) then
        tmp = x + ((y * 6.0d0) * z)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = 6.0 * (z * (y - x));
	double tmp;
	if (z <= -49000.0) {
		tmp = t_0;
	} else if (z <= 1.6e-12) {
		tmp = x + ((y * 6.0) * z);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = 6.0 * (z * (y - x))
	tmp = 0
	if z <= -49000.0:
		tmp = t_0
	elif z <= 1.6e-12:
		tmp = x + ((y * 6.0) * z)
	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 <= -49000.0)
		tmp = t_0;
	elseif (z <= 1.6e-12)
		tmp = Float64(x + Float64(Float64(y * 6.0) * z));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = 6.0 * (z * (y - x));
	tmp = 0.0;
	if (z <= -49000.0)
		tmp = t_0;
	elseif (z <= 1.6e-12)
		tmp = x + ((y * 6.0) * z);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(6 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -49000], t$95$0, If[LessEqual[z, 3961408125713217/2475880078570760549798248448], N[(x + N[(N[(y * 6), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := 6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{if}\;z \leq -49000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq \frac{3961408125713217}{2475880078570760549798248448}:\\
\;\;\;\;x + \left(y \cdot 6\right) \cdot z\\

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


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -49000 or 1.6e-12 < z

    1. Initial program 99.7%

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

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

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

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

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

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

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

        \[\leadsto x \cdot 1 \]
      2. Taylor expanded in x around 0

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

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

          \[\leadsto 6 \cdot \left(y \cdot \color{blue}{z}\right) \]
      4. Applied rewrites42.0%

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

        \[\leadsto \color{blue}{6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
      6. 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--.f6464.9%

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

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

      if -49000 < z < 1.6e-12

      1. Initial program 99.7%

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

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

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

      Alternative 3: 98.5% accurate, 0.7× speedup?

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

        1. Initial program 99.7%

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

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

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

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

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

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

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

            \[\leadsto x \cdot 1 \]
          2. Taylor expanded in x around 0

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

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

              \[\leadsto 6 \cdot \left(y \cdot \color{blue}{z}\right) \]
          4. Applied rewrites42.0%

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

            \[\leadsto \color{blue}{6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
          6. 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--.f6464.9%

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

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

          if -49000 < z < 1.6e-12

          1. Initial program 99.7%

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

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

              \[\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. metadata-evalN/A

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

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

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

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

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

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

          Alternative 4: 98.4% accurate, 0.7× speedup?

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

            1. Initial program 99.7%

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

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

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

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

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

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

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

                \[\leadsto x \cdot 1 \]
              2. Taylor expanded in x around 0

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

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

                  \[\leadsto 6 \cdot \left(y \cdot \color{blue}{z}\right) \]
              4. Applied rewrites42.0%

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

                \[\leadsto \color{blue}{6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
              6. 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--.f6464.9%

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

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

              if -49000 < z < 1.6e-12

              1. Initial program 99.7%

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

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

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

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

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

            Alternative 5: 85.1% accurate, 0.7× speedup?

            \[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq \frac{-870426590122533}{19342813113834066795298816}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq \frac{2918326469422347}{187072209578355573530071658587684226515959365500928}:\\ \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
            (FPCore (x y z)
              :precision binary64
              (let* ((t_0 (* 6 (* z (- y x)))))
              (if (<= z -870426590122533/19342813113834066795298816)
                t_0
                (if (<=
                     z
                     2918326469422347/187072209578355573530071658587684226515959365500928)
                  (+ x (* -6 (* x z)))
                  t_0))))
            double code(double x, double y, double z) {
            	double t_0 = 6.0 * (z * (y - x));
            	double tmp;
            	if (z <= -4.5e-11) {
            		tmp = t_0;
            	} else if (z <= 1.56e-35) {
            		tmp = x + (-6.0 * (x * z));
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y, z)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8) :: t_0
                real(8) :: tmp
                t_0 = 6.0d0 * (z * (y - x))
                if (z <= (-4.5d-11)) then
                    tmp = t_0
                else if (z <= 1.56d-35) then
                    tmp = x + ((-6.0d0) * (x * z))
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = 6.0 * (z * (y - x));
            	double tmp;
            	if (z <= -4.5e-11) {
            		tmp = t_0;
            	} else if (z <= 1.56e-35) {
            		tmp = x + (-6.0 * (x * z));
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = 6.0 * (z * (y - x))
            	tmp = 0
            	if z <= -4.5e-11:
            		tmp = t_0
            	elif z <= 1.56e-35:
            		tmp = x + (-6.0 * (x * z))
            	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 <= -4.5e-11)
            		tmp = t_0;
            	elseif (z <= 1.56e-35)
            		tmp = Float64(x + Float64(-6.0 * Float64(x * z)));
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = 6.0 * (z * (y - x));
            	tmp = 0.0;
            	if (z <= -4.5e-11)
            		tmp = t_0;
            	elseif (z <= 1.56e-35)
            		tmp = x + (-6.0 * (x * z));
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[(6 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -870426590122533/19342813113834066795298816], t$95$0, If[LessEqual[z, 2918326469422347/187072209578355573530071658587684226515959365500928], N[(x + N[(-6 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            t_0 := 6 \cdot \left(z \cdot \left(y - x\right)\right)\\
            \mathbf{if}\;z \leq \frac{-870426590122533}{19342813113834066795298816}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;z \leq \frac{2918326469422347}{187072209578355573530071658587684226515959365500928}:\\
            \;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z < -4.5e-11 or 1.56e-35 < z

              1. Initial program 99.7%

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

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

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

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

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

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

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

                  \[\leadsto x \cdot 1 \]
                2. Taylor expanded in x around 0

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

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

                    \[\leadsto 6 \cdot \left(y \cdot \color{blue}{z}\right) \]
                4. Applied rewrites42.0%

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

                  \[\leadsto \color{blue}{6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
                6. 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--.f6464.9%

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

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

                if -4.5e-11 < z < 1.56e-35

                1. Initial program 99.7%

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

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

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

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

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

              Alternative 6: 85.1% accurate, 0.7× speedup?

              \[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq \frac{-870426590122533}{19342813113834066795298816}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq \frac{2918326469422347}{187072209578355573530071658587684226515959365500928}:\\ \;\;\;\;x \cdot \left(1 + -6 \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
              (FPCore (x y z)
                :precision binary64
                (let* ((t_0 (* 6 (* z (- y x)))))
                (if (<= z -870426590122533/19342813113834066795298816)
                  t_0
                  (if (<=
                       z
                       2918326469422347/187072209578355573530071658587684226515959365500928)
                    (* x (+ 1 (* -6 z)))
                    t_0))))
              double code(double x, double y, double z) {
              	double t_0 = 6.0 * (z * (y - x));
              	double tmp;
              	if (z <= -4.5e-11) {
              		tmp = t_0;
              	} else if (z <= 1.56e-35) {
              		tmp = x * (1.0 + (-6.0 * z));
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x, y, z)
              use fmin_fmax_functions
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8), intent (in) :: z
                  real(8) :: t_0
                  real(8) :: tmp
                  t_0 = 6.0d0 * (z * (y - x))
                  if (z <= (-4.5d-11)) then
                      tmp = t_0
                  else if (z <= 1.56d-35) then
                      tmp = x * (1.0d0 + ((-6.0d0) * z))
                  else
                      tmp = t_0
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z) {
              	double t_0 = 6.0 * (z * (y - x));
              	double tmp;
              	if (z <= -4.5e-11) {
              		tmp = t_0;
              	} else if (z <= 1.56e-35) {
              		tmp = x * (1.0 + (-6.0 * z));
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              def code(x, y, z):
              	t_0 = 6.0 * (z * (y - x))
              	tmp = 0
              	if z <= -4.5e-11:
              		tmp = t_0
              	elif z <= 1.56e-35:
              		tmp = x * (1.0 + (-6.0 * z))
              	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 <= -4.5e-11)
              		tmp = t_0;
              	elseif (z <= 1.56e-35)
              		tmp = Float64(x * Float64(1.0 + Float64(-6.0 * z)));
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z)
              	t_0 = 6.0 * (z * (y - x));
              	tmp = 0.0;
              	if (z <= -4.5e-11)
              		tmp = t_0;
              	elseif (z <= 1.56e-35)
              		tmp = x * (1.0 + (-6.0 * z));
              	else
              		tmp = t_0;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_] := Block[{t$95$0 = N[(6 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -870426590122533/19342813113834066795298816], t$95$0, If[LessEqual[z, 2918326469422347/187072209578355573530071658587684226515959365500928], N[(x * N[(1 + N[(-6 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
              
              \begin{array}{l}
              t_0 := 6 \cdot \left(z \cdot \left(y - x\right)\right)\\
              \mathbf{if}\;z \leq \frac{-870426590122533}{19342813113834066795298816}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;z \leq \frac{2918326469422347}{187072209578355573530071658587684226515959365500928}:\\
              \;\;\;\;x \cdot \left(1 + -6 \cdot z\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if z < -4.5e-11 or 1.56e-35 < z

                1. Initial program 99.7%

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

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

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

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

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

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

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

                    \[\leadsto x \cdot 1 \]
                  2. Taylor expanded in x around 0

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

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

                      \[\leadsto 6 \cdot \left(y \cdot \color{blue}{z}\right) \]
                  4. Applied rewrites42.0%

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

                    \[\leadsto \color{blue}{6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
                  6. 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--.f6464.9%

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

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

                  if -4.5e-11 < z < 1.56e-35

                  1. Initial program 99.7%

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

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

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

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

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

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

                Alternative 7: 85.1% accurate, 0.7× speedup?

                \[\begin{array}{l} t_0 := 6 \cdot \left(z \cdot \left(y - x\right)\right)\\ \mathbf{if}\;z \leq \frac{-870426590122533}{19342813113834066795298816}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq \frac{2918326469422347}{187072209578355573530071658587684226515959365500928}:\\ \;\;\;\;x \cdot 1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
                (FPCore (x y z)
                  :precision binary64
                  (let* ((t_0 (* 6 (* z (- y x)))))
                  (if (<= z -870426590122533/19342813113834066795298816)
                    t_0
                    (if (<=
                         z
                         2918326469422347/187072209578355573530071658587684226515959365500928)
                      (* x 1)
                      t_0))))
                double code(double x, double y, double z) {
                	double t_0 = 6.0 * (z * (y - x));
                	double tmp;
                	if (z <= -4.5e-11) {
                		tmp = t_0;
                	} else if (z <= 1.56e-35) {
                		tmp = x * 1.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 * (z * (y - x))
                    if (z <= (-4.5d-11)) then
                        tmp = t_0
                    else if (z <= 1.56d-35) then
                        tmp = x * 1.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 * (z * (y - x));
                	double tmp;
                	if (z <= -4.5e-11) {
                		tmp = t_0;
                	} else if (z <= 1.56e-35) {
                		tmp = x * 1.0;
                	} else {
                		tmp = t_0;
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	t_0 = 6.0 * (z * (y - x))
                	tmp = 0
                	if z <= -4.5e-11:
                		tmp = t_0
                	elif z <= 1.56e-35:
                		tmp = x * 1.0
                	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 <= -4.5e-11)
                		tmp = t_0;
                	elseif (z <= 1.56e-35)
                		tmp = Float64(x * 1.0);
                	else
                		tmp = t_0;
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	t_0 = 6.0 * (z * (y - x));
                	tmp = 0.0;
                	if (z <= -4.5e-11)
                		tmp = t_0;
                	elseif (z <= 1.56e-35)
                		tmp = x * 1.0;
                	else
                		tmp = t_0;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := Block[{t$95$0 = N[(6 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -870426590122533/19342813113834066795298816], t$95$0, If[LessEqual[z, 2918326469422347/187072209578355573530071658587684226515959365500928], N[(x * 1), $MachinePrecision], t$95$0]]]
                
                \begin{array}{l}
                t_0 := 6 \cdot \left(z \cdot \left(y - x\right)\right)\\
                \mathbf{if}\;z \leq \frac{-870426590122533}{19342813113834066795298816}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;z \leq \frac{2918326469422347}{187072209578355573530071658587684226515959365500928}:\\
                \;\;\;\;x \cdot 1\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0\\
                
                
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if z < -4.5e-11 or 1.56e-35 < z

                  1. Initial program 99.7%

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

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

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

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

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

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

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

                      \[\leadsto x \cdot 1 \]
                    2. Taylor expanded in x around 0

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

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

                        \[\leadsto 6 \cdot \left(y \cdot \color{blue}{z}\right) \]
                    4. Applied rewrites42.0%

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

                      \[\leadsto \color{blue}{6 \cdot \left(z \cdot \left(y - x\right)\right)} \]
                    6. 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--.f6464.9%

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

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

                    if -4.5e-11 < z < 1.56e-35

                    1. Initial program 99.7%

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

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

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

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

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

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

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

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

                    Alternative 8: 61.8% accurate, 0.6× speedup?

                    \[\begin{array}{l} \mathbf{if}\;z \leq \frac{-870426590122533}{19342813113834066795298816}:\\ \;\;\;\;\left(6 \cdot y\right) \cdot z\\ \mathbf{elif}\;z \leq \frac{2918326469422347}{187072209578355573530071658587684226515959365500928}:\\ \;\;\;\;x \cdot 1\\ \mathbf{elif}\;z \leq 59999999999999995807196081557826383708039989008338610955695381169883378996985483422571781521365526805463368204288:\\ \;\;\;\;6 \cdot \left(y \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \end{array} \]
                    (FPCore (x y z)
                      :precision binary64
                      (if (<= z -870426590122533/19342813113834066795298816)
                      (* (* 6 y) z)
                      (if (<=
                           z
                           2918326469422347/187072209578355573530071658587684226515959365500928)
                        (* x 1)
                        (if (<=
                             z
                             59999999999999995807196081557826383708039989008338610955695381169883378996985483422571781521365526805463368204288)
                          (* 6 (* y z))
                          (* -6 (* x z))))))
                    double code(double x, double y, double z) {
                    	double tmp;
                    	if (z <= -4.5e-11) {
                    		tmp = (6.0 * y) * z;
                    	} else if (z <= 1.56e-35) {
                    		tmp = x * 1.0;
                    	} else if (z <= 6e+112) {
                    		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 <= (-4.5d-11)) then
                            tmp = (6.0d0 * y) * z
                        else if (z <= 1.56d-35) then
                            tmp = x * 1.0d0
                        else if (z <= 6d+112) 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 <= -4.5e-11) {
                    		tmp = (6.0 * y) * z;
                    	} else if (z <= 1.56e-35) {
                    		tmp = x * 1.0;
                    	} else if (z <= 6e+112) {
                    		tmp = 6.0 * (y * z);
                    	} else {
                    		tmp = -6.0 * (x * z);
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y, z):
                    	tmp = 0
                    	if z <= -4.5e-11:
                    		tmp = (6.0 * y) * z
                    	elif z <= 1.56e-35:
                    		tmp = x * 1.0
                    	elif z <= 6e+112:
                    		tmp = 6.0 * (y * z)
                    	else:
                    		tmp = -6.0 * (x * z)
                    	return tmp
                    
                    function code(x, y, z)
                    	tmp = 0.0
                    	if (z <= -4.5e-11)
                    		tmp = Float64(Float64(6.0 * y) * z);
                    	elseif (z <= 1.56e-35)
                    		tmp = Float64(x * 1.0);
                    	elseif (z <= 6e+112)
                    		tmp = Float64(6.0 * Float64(y * z));
                    	else
                    		tmp = Float64(-6.0 * Float64(x * z));
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y, z)
                    	tmp = 0.0;
                    	if (z <= -4.5e-11)
                    		tmp = (6.0 * y) * z;
                    	elseif (z <= 1.56e-35)
                    		tmp = x * 1.0;
                    	elseif (z <= 6e+112)
                    		tmp = 6.0 * (y * z);
                    	else
                    		tmp = -6.0 * (x * z);
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_, z_] := If[LessEqual[z, -870426590122533/19342813113834066795298816], N[(N[(6 * y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 2918326469422347/187072209578355573530071658587684226515959365500928], N[(x * 1), $MachinePrecision], If[LessEqual[z, 59999999999999995807196081557826383708039989008338610955695381169883378996985483422571781521365526805463368204288], N[(6 * N[(y * z), $MachinePrecision]), $MachinePrecision], N[(-6 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]
                    
                    \begin{array}{l}
                    \mathbf{if}\;z \leq \frac{-870426590122533}{19342813113834066795298816}:\\
                    \;\;\;\;\left(6 \cdot y\right) \cdot z\\
                    
                    \mathbf{elif}\;z \leq \frac{2918326469422347}{187072209578355573530071658587684226515959365500928}:\\
                    \;\;\;\;x \cdot 1\\
                    
                    \mathbf{elif}\;z \leq 59999999999999995807196081557826383708039989008338610955695381169883378996985483422571781521365526805463368204288:\\
                    \;\;\;\;6 \cdot \left(y \cdot z\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;-6 \cdot \left(x \cdot z\right)\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 4 regimes
                    2. if z < -4.5e-11

                      1. Initial program 99.7%

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

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

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

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

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

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

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

                          \[\leadsto x \cdot 1 \]
                        2. Taylor expanded in x around 0

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

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

                            \[\leadsto 6 \cdot \left(y \cdot \color{blue}{z}\right) \]
                        4. Applied rewrites42.0%

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

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

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

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

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

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

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

                        if -4.5e-11 < z < 1.56e-35

                        1. Initial program 99.7%

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

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

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

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

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

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

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

                            \[\leadsto x \cdot 1 \]

                          if 1.56e-35 < z < 5.9999999999999996e112

                          1. Initial program 99.7%

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

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

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

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

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

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

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

                              \[\leadsto x \cdot 1 \]
                            2. Taylor expanded in x around 0

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

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

                                \[\leadsto 6 \cdot \left(y \cdot \color{blue}{z}\right) \]
                            4. Applied rewrites42.0%

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

                            if 5.9999999999999996e112 < z

                            1. Initial program 99.7%

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

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

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

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

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

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

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

                                \[\leadsto x \cdot 1 \]
                              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.4%

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

                                \[\leadsto x \cdot \left(-6 \cdot \color{blue}{z}\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.4%

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

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

                            Alternative 9: 61.8% accurate, 0.6× speedup?

                            \[\begin{array}{l} t_0 := 6 \cdot \left(y \cdot z\right)\\ \mathbf{if}\;z \leq \frac{-870426590122533}{19342813113834066795298816}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq \frac{2918326469422347}{187072209578355573530071658587684226515959365500928}:\\ \;\;\;\;x \cdot 1\\ \mathbf{elif}\;z \leq 59999999999999995807196081557826383708039989008338610955695381169883378996985483422571781521365526805463368204288:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;-6 \cdot \left(x \cdot z\right)\\ \end{array} \]
                            (FPCore (x y z)
                              :precision binary64
                              (let* ((t_0 (* 6 (* y z))))
                              (if (<= z -870426590122533/19342813113834066795298816)
                                t_0
                                (if (<=
                                     z
                                     2918326469422347/187072209578355573530071658587684226515959365500928)
                                  (* x 1)
                                  (if (<=
                                       z
                                       59999999999999995807196081557826383708039989008338610955695381169883378996985483422571781521365526805463368204288)
                                    t_0
                                    (* -6 (* x z)))))))
                            double code(double x, double y, double z) {
                            	double t_0 = 6.0 * (y * z);
                            	double tmp;
                            	if (z <= -4.5e-11) {
                            		tmp = t_0;
                            	} else if (z <= 1.56e-35) {
                            		tmp = x * 1.0;
                            	} else if (z <= 6e+112) {
                            		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 <= (-4.5d-11)) then
                                    tmp = t_0
                                else if (z <= 1.56d-35) then
                                    tmp = x * 1.0d0
                                else if (z <= 6d+112) 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 <= -4.5e-11) {
                            		tmp = t_0;
                            	} else if (z <= 1.56e-35) {
                            		tmp = x * 1.0;
                            	} else if (z <= 6e+112) {
                            		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 <= -4.5e-11:
                            		tmp = t_0
                            	elif z <= 1.56e-35:
                            		tmp = x * 1.0
                            	elif z <= 6e+112:
                            		tmp = t_0
                            	else:
                            		tmp = -6.0 * (x * z)
                            	return tmp
                            
                            function code(x, y, z)
                            	t_0 = Float64(6.0 * Float64(y * z))
                            	tmp = 0.0
                            	if (z <= -4.5e-11)
                            		tmp = t_0;
                            	elseif (z <= 1.56e-35)
                            		tmp = Float64(x * 1.0);
                            	elseif (z <= 6e+112)
                            		tmp = t_0;
                            	else
                            		tmp = Float64(-6.0 * Float64(x * z));
                            	end
                            	return tmp
                            end
                            
                            function tmp_2 = code(x, y, z)
                            	t_0 = 6.0 * (y * z);
                            	tmp = 0.0;
                            	if (z <= -4.5e-11)
                            		tmp = t_0;
                            	elseif (z <= 1.56e-35)
                            		tmp = x * 1.0;
                            	elseif (z <= 6e+112)
                            		tmp = t_0;
                            	else
                            		tmp = -6.0 * (x * z);
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            code[x_, y_, z_] := Block[{t$95$0 = N[(6 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -870426590122533/19342813113834066795298816], t$95$0, If[LessEqual[z, 2918326469422347/187072209578355573530071658587684226515959365500928], N[(x * 1), $MachinePrecision], If[LessEqual[z, 59999999999999995807196081557826383708039989008338610955695381169883378996985483422571781521365526805463368204288], t$95$0, N[(-6 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]
                            
                            \begin{array}{l}
                            t_0 := 6 \cdot \left(y \cdot z\right)\\
                            \mathbf{if}\;z \leq \frac{-870426590122533}{19342813113834066795298816}:\\
                            \;\;\;\;t\_0\\
                            
                            \mathbf{elif}\;z \leq \frac{2918326469422347}{187072209578355573530071658587684226515959365500928}:\\
                            \;\;\;\;x \cdot 1\\
                            
                            \mathbf{elif}\;z \leq 59999999999999995807196081557826383708039989008338610955695381169883378996985483422571781521365526805463368204288:\\
                            \;\;\;\;t\_0\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;-6 \cdot \left(x \cdot z\right)\\
                            
                            
                            \end{array}
                            
                            Derivation
                            1. Split input into 3 regimes
                            2. if z < -4.5e-11 or 1.56e-35 < z < 5.9999999999999996e112

                              1. Initial program 99.7%

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

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

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

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

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

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

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

                                  \[\leadsto x \cdot 1 \]
                                2. Taylor expanded in x around 0

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

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

                                    \[\leadsto 6 \cdot \left(y \cdot \color{blue}{z}\right) \]
                                4. Applied rewrites42.0%

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

                                if -4.5e-11 < z < 1.56e-35

                                1. Initial program 99.7%

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

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

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

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

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

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

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

                                    \[\leadsto x \cdot 1 \]

                                  if 5.9999999999999996e112 < z

                                  1. Initial program 99.7%

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

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

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

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

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

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

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

                                      \[\leadsto x \cdot 1 \]
                                    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.4%

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

                                      \[\leadsto x \cdot \left(-6 \cdot \color{blue}{z}\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.4%

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

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

                                  Alternative 10: 60.5% accurate, 0.7× speedup?

                                  \[\begin{array}{l} t_0 := -6 \cdot \left(x \cdot z\right)\\ \mathbf{if}\;z \leq -49000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq \frac{700976274800963}{9223372036854775808}:\\ \;\;\;\;x \cdot 1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
                                  (FPCore (x y z)
                                    :precision binary64
                                    (let* ((t_0 (* -6 (* x z))))
                                    (if (<= z -49000)
                                      t_0
                                      (if (<= z 700976274800963/9223372036854775808) (* x 1) t_0))))
                                  double code(double x, double y, double z) {
                                  	double t_0 = -6.0 * (x * z);
                                  	double tmp;
                                  	if (z <= -49000.0) {
                                  		tmp = t_0;
                                  	} else if (z <= 7.6e-5) {
                                  		tmp = x * 1.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 <= (-49000.0d0)) then
                                          tmp = t_0
                                      else if (z <= 7.6d-5) then
                                          tmp = x * 1.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 <= -49000.0) {
                                  		tmp = t_0;
                                  	} else if (z <= 7.6e-5) {
                                  		tmp = x * 1.0;
                                  	} else {
                                  		tmp = t_0;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  def code(x, y, z):
                                  	t_0 = -6.0 * (x * z)
                                  	tmp = 0
                                  	if z <= -49000.0:
                                  		tmp = t_0
                                  	elif z <= 7.6e-5:
                                  		tmp = x * 1.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 <= -49000.0)
                                  		tmp = t_0;
                                  	elseif (z <= 7.6e-5)
                                  		tmp = Float64(x * 1.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 <= -49000.0)
                                  		tmp = t_0;
                                  	elseif (z <= 7.6e-5)
                                  		tmp = x * 1.0;
                                  	else
                                  		tmp = t_0;
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  code[x_, y_, z_] := Block[{t$95$0 = N[(-6 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -49000], t$95$0, If[LessEqual[z, 700976274800963/9223372036854775808], N[(x * 1), $MachinePrecision], t$95$0]]]
                                  
                                  \begin{array}{l}
                                  t_0 := -6 \cdot \left(x \cdot z\right)\\
                                  \mathbf{if}\;z \leq -49000:\\
                                  \;\;\;\;t\_0\\
                                  
                                  \mathbf{elif}\;z \leq \frac{700976274800963}{9223372036854775808}:\\
                                  \;\;\;\;x \cdot 1\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;t\_0\\
                                  
                                  
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if z < -49000 or 7.6000000000000004e-5 < z

                                    1. Initial program 99.7%

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

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

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

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

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

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

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

                                        \[\leadsto x \cdot 1 \]
                                      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.4%

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

                                        \[\leadsto x \cdot \left(-6 \cdot \color{blue}{z}\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.4%

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

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

                                      if -49000 < z < 7.6000000000000004e-5

                                      1. Initial program 99.7%

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

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

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

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

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

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

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

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

                                      Alternative 11: 36.5% accurate, 2.8× speedup?

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

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

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

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

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

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

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

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

                                          \[\leadsto x \cdot 1 \]
                                        2. Add Preprocessing

                                        Reproduce

                                        ?
                                        herbie shell --seed 2025271 -o generate:evaluate
                                        (FPCore (x y z)
                                          :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
                                          :precision binary64
                                          (+ x (* (* (- y x) 6) z)))