Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C

Percentage Accurate: 99.9% → 99.9%
Time: 3.9s
Alternatives: 14
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(x + \sin y\right) + z \cdot \cos y \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
	return (x + sin(y)) + (z * cos(y));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
	return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z):
	return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z)
	return Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
end
function tmp = code(x, y, z)
	tmp = (x + sin(y)) + (z * cos(y));
end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 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.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x + \sin y\right) + z \cdot \cos y \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
	return (x + sin(y)) + (z * cos(y));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
	return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z):
	return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z)
	return Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
end
function tmp = code(x, y, z)
	tmp = (x + sin(y)) + (z * cos(y));
end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x + \sin y\right) + z \cdot \cos y \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
	return (x + sin(y)) + (z * cos(y));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
	return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z):
	return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z)
	return Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
end
function tmp = code(x, y, z)
	tmp = (x + sin(y)) + (z * cos(y));
end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(x + \sin y\right) + z \cdot \cos y \]
  2. Add Preprocessing

Alternative 2: 98.0% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin y + x\\ t_1 := \left(x + \sin y\right) + z \cdot \cos y\\ t_2 := \mathsf{fma}\left(\cos y, z, x\right)\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+28}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq -0.05:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 10^{-10}:\\ \;\;\;\;\left(z + y\right) + x\\ \mathbf{elif}\;t\_1 \leq 1:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ (sin y) x))
        (t_1 (+ (+ x (sin y)) (* z (cos y))))
        (t_2 (fma (cos y) z x)))
   (if (<= t_1 -5e+28)
     t_2
     (if (<= t_1 -0.05)
       t_0
       (if (<= t_1 1e-10) (+ (+ z y) x) (if (<= t_1 1.0) t_0 t_2))))))
double code(double x, double y, double z) {
	double t_0 = sin(y) + x;
	double t_1 = (x + sin(y)) + (z * cos(y));
	double t_2 = fma(cos(y), z, x);
	double tmp;
	if (t_1 <= -5e+28) {
		tmp = t_2;
	} else if (t_1 <= -0.05) {
		tmp = t_0;
	} else if (t_1 <= 1e-10) {
		tmp = (z + y) + x;
	} else if (t_1 <= 1.0) {
		tmp = t_0;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(sin(y) + x)
	t_1 = Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
	t_2 = fma(cos(y), z, x)
	tmp = 0.0
	if (t_1 <= -5e+28)
		tmp = t_2;
	elseif (t_1 <= -0.05)
		tmp = t_0;
	elseif (t_1 <= 1e-10)
		tmp = Float64(Float64(z + y) + x);
	elseif (t_1 <= 1.0)
		tmp = t_0;
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[y], $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+28], t$95$2, If[LessEqual[t$95$1, -0.05], t$95$0, If[LessEqual[t$95$1, 1e-10], N[(N[(z + y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 1.0], t$95$0, t$95$2]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin y + x\\
t_1 := \left(x + \sin y\right) + z \cdot \cos y\\
t_2 := \mathsf{fma}\left(\cos y, z, x\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+28}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq -0.05:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq 10^{-10}:\\
\;\;\;\;\left(z + y\right) + x\\

\mathbf{elif}\;t\_1 \leq 1:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -4.99999999999999957e28 or 1 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y)))

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{x} + z \cdot \cos y \]
    3. Step-by-step derivation
      1. Applied rewrites99.6%

        \[\leadsto \color{blue}{x} + z \cdot \cos y \]
      2. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \color{blue}{x + z \cdot \cos y} \]
        2. lift-*.f64N/A

          \[\leadsto x + \color{blue}{z \cdot \cos y} \]
        3. lift-cos.f64N/A

          \[\leadsto x + z \cdot \color{blue}{\cos y} \]
        4. +-commutativeN/A

          \[\leadsto \color{blue}{z \cdot \cos y + x} \]
        5. *-commutativeN/A

          \[\leadsto \color{blue}{\cos y \cdot z} + x \]
        6. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, z, x\right)} \]
        7. lift-cos.f6499.6

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

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

      if -4.99999999999999957e28 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.050000000000000003 or 1.00000000000000004e-10 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1

      1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x + \sin y} \]
      3. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \sin y + \color{blue}{x} \]
        2. lower-+.f64N/A

          \[\leadsto \sin y + \color{blue}{x} \]
        3. lift-sin.f6490.7

          \[\leadsto \sin y + x \]
      4. Applied rewrites90.7%

        \[\leadsto \color{blue}{\sin y + x} \]

      if -0.050000000000000003 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1.00000000000000004e-10

      1. Initial program 100.0%

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

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

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

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

          \[\leadsto \left(z + y\right) + x \]
        4. lower-+.f6498.1

          \[\leadsto \left(z + y\right) + x \]
      4. Applied rewrites98.1%

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

    Alternative 3: 95.2% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(\cos y, z, x\right)\\ \mathbf{if}\;x \leq -6.5 \cdot 10^{-15}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 8 \cdot 10^{-51}:\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (fma (cos y) z x)))
       (if (<= x -6.5e-15) t_0 (if (<= x 8e-51) (fma (cos y) z (sin y)) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = fma(cos(y), z, x);
    	double tmp;
    	if (x <= -6.5e-15) {
    		tmp = t_0;
    	} else if (x <= 8e-51) {
    		tmp = fma(cos(y), z, sin(y));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = fma(cos(y), z, x)
    	tmp = 0.0
    	if (x <= -6.5e-15)
    		tmp = t_0;
    	elseif (x <= 8e-51)
    		tmp = fma(cos(y), z, sin(y));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[x, -6.5e-15], t$95$0, If[LessEqual[x, 8e-51], N[(N[Cos[y], $MachinePrecision] * z + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \mathsf{fma}\left(\cos y, z, x\right)\\
    \mathbf{if}\;x \leq -6.5 \cdot 10^{-15}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 8 \cdot 10^{-51}:\\
    \;\;\;\;\mathsf{fma}\left(\cos y, z, \sin y\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -6.49999999999999991e-15 or 8.0000000000000001e-51 < x

      1. Initial program 99.9%

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

        \[\leadsto \color{blue}{x} + z \cdot \cos y \]
      3. Step-by-step derivation
        1. Applied rewrites97.0%

          \[\leadsto \color{blue}{x} + z \cdot \cos y \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \color{blue}{x + z \cdot \cos y} \]
          2. lift-*.f64N/A

            \[\leadsto x + \color{blue}{z \cdot \cos y} \]
          3. lift-cos.f64N/A

            \[\leadsto x + z \cdot \color{blue}{\cos y} \]
          4. +-commutativeN/A

            \[\leadsto \color{blue}{z \cdot \cos y + x} \]
          5. *-commutativeN/A

            \[\leadsto \color{blue}{\cos y \cdot z} + x \]
          6. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, z, x\right)} \]
          7. lift-cos.f6497.0

            \[\leadsto \mathsf{fma}\left(\color{blue}{\cos y}, z, x\right) \]
        3. Applied rewrites97.0%

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

        if -6.49999999999999991e-15 < x < 8.0000000000000001e-51

        1. Initial program 99.9%

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

          \[\leadsto \color{blue}{\sin y + z \cdot \cos y} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto z \cdot \cos y + \color{blue}{\sin y} \]
          2. *-commutativeN/A

            \[\leadsto \cos y \cdot z + \sin \color{blue}{y} \]
          3. lower-fma.f64N/A

            \[\leadsto \mathsf{fma}\left(\cos y, \color{blue}{z}, \sin y\right) \]
          4. lift-cos.f64N/A

            \[\leadsto \mathsf{fma}\left(\cos y, z, \sin y\right) \]
          5. lift-sin.f6493.1

            \[\leadsto \mathsf{fma}\left(\cos y, z, \sin y\right) \]
        4. Applied rewrites93.1%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, z, \sin y\right)} \]
      4. Recombined 2 regimes into one program.
      5. Add Preprocessing

      Alternative 4: 83.0% accurate, 1.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos y \cdot z\\ \mathbf{if}\;z \leq -1.56 \cdot 10^{+181}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -6 \cdot 10^{+26}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{+14}:\\ \;\;\;\;\sin y + x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (* (cos y) z)))
         (if (<= z -1.56e+181)
           t_0
           (if (<= z -6e+26) (+ z x) (if (<= z 8.5e+14) (+ (sin y) x) t_0)))))
      double code(double x, double y, double z) {
      	double t_0 = cos(y) * z;
      	double tmp;
      	if (z <= -1.56e+181) {
      		tmp = t_0;
      	} else if (z <= -6e+26) {
      		tmp = z + x;
      	} else if (z <= 8.5e+14) {
      		tmp = sin(y) + x;
      	} 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 = cos(y) * z
          if (z <= (-1.56d+181)) then
              tmp = t_0
          else if (z <= (-6d+26)) then
              tmp = z + x
          else if (z <= 8.5d+14) then
              tmp = sin(y) + x
          else
              tmp = t_0
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double t_0 = Math.cos(y) * z;
      	double tmp;
      	if (z <= -1.56e+181) {
      		tmp = t_0;
      	} else if (z <= -6e+26) {
      		tmp = z + x;
      	} else if (z <= 8.5e+14) {
      		tmp = Math.sin(y) + x;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = math.cos(y) * z
      	tmp = 0
      	if z <= -1.56e+181:
      		tmp = t_0
      	elif z <= -6e+26:
      		tmp = z + x
      	elif z <= 8.5e+14:
      		tmp = math.sin(y) + x
      	else:
      		tmp = t_0
      	return tmp
      
      function code(x, y, z)
      	t_0 = Float64(cos(y) * z)
      	tmp = 0.0
      	if (z <= -1.56e+181)
      		tmp = t_0;
      	elseif (z <= -6e+26)
      		tmp = Float64(z + x);
      	elseif (z <= 8.5e+14)
      		tmp = Float64(sin(y) + x);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = cos(y) * z;
      	tmp = 0.0;
      	if (z <= -1.56e+181)
      		tmp = t_0;
      	elseif (z <= -6e+26)
      		tmp = z + x;
      	elseif (z <= 8.5e+14)
      		tmp = sin(y) + x;
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.56e+181], t$95$0, If[LessEqual[z, -6e+26], N[(z + x), $MachinePrecision], If[LessEqual[z, 8.5e+14], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], t$95$0]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \cos y \cdot z\\
      \mathbf{if}\;z \leq -1.56 \cdot 10^{+181}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;z \leq -6 \cdot 10^{+26}:\\
      \;\;\;\;z + x\\
      
      \mathbf{elif}\;z \leq 8.5 \cdot 10^{+14}:\\
      \;\;\;\;\sin y + x\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if z < -1.56e181 or 8.5e14 < z

        1. Initial program 99.8%

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

          \[\leadsto \color{blue}{z \cdot \cos y} \]
        3. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \cos y \cdot \color{blue}{z} \]
          2. lower-*.f64N/A

            \[\leadsto \cos y \cdot \color{blue}{z} \]
          3. lift-cos.f6479.7

            \[\leadsto \cos y \cdot z \]
        4. Applied rewrites79.7%

          \[\leadsto \color{blue}{\cos y \cdot z} \]

        if -1.56e181 < z < -5.99999999999999994e26

        1. Initial program 99.8%

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

          \[\leadsto \color{blue}{x + z} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto z + \color{blue}{x} \]
          2. lower-+.f6468.8

            \[\leadsto z + \color{blue}{x} \]
        4. Applied rewrites68.8%

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

        if -5.99999999999999994e26 < z < 8.5e14

        1. Initial program 100.0%

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

          \[\leadsto \color{blue}{x + \sin y} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \sin y + \color{blue}{x} \]
          2. lower-+.f64N/A

            \[\leadsto \sin y + \color{blue}{x} \]
          3. lift-sin.f6488.3

            \[\leadsto \sin y + x \]
        4. Applied rewrites88.3%

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

      Alternative 5: 81.4% accurate, 1.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin y + x\\ \mathbf{if}\;y \leq -0.055:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{+16}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z\right) + x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (+ (sin y) x)))
         (if (<= y -0.055)
           t_0
           (if (<= y 2.7e+16)
             (+ (fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y z) x)
             t_0))))
      double code(double x, double y, double z) {
      	double t_0 = sin(y) + x;
      	double tmp;
      	if (y <= -0.055) {
      		tmp = t_0;
      	} else if (y <= 2.7e+16) {
      		tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, z) + x;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = Float64(sin(y) + x)
      	tmp = 0.0
      	if (y <= -0.055)
      		tmp = t_0;
      	elseif (y <= 2.7e+16)
      		tmp = Float64(fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, z) + x);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -0.055], t$95$0, If[LessEqual[y, 2.7e+16], N[(N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + z), $MachinePrecision] + x), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \sin y + x\\
      \mathbf{if}\;y \leq -0.055:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;y \leq 2.7 \cdot 10^{+16}:\\
      \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z\right) + x\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -0.0550000000000000003 or 2.7e16 < y

        1. Initial program 99.8%

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

          \[\leadsto \color{blue}{x + \sin y} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \sin y + \color{blue}{x} \]
          2. lower-+.f64N/A

            \[\leadsto \sin y + \color{blue}{x} \]
          3. lift-sin.f6463.0

            \[\leadsto \sin y + x \]
        4. Applied rewrites63.0%

          \[\leadsto \color{blue}{\sin y + x} \]

        if -0.0550000000000000003 < y < 2.7e16

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, y, \frac{-1}{2} \cdot z\right), y, 1\right), y, z\right) + x \]
          11. lower-*.f6498.1

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z\right) + x \]
        4. Applied rewrites98.1%

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

      Alternative 6: 81.0% accurate, 0.2× speedup?

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

        1. Initial program 99.9%

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

          \[\leadsto \color{blue}{x + z} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto z + \color{blue}{x} \]
          2. lower-+.f6476.7

            \[\leadsto z + \color{blue}{x} \]
        4. Applied rewrites76.7%

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

        if -400 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.050000000000000003 or 1.00000000000000004e-10 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1

        1. Initial program 99.9%

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

          \[\leadsto \color{blue}{\sin y + z \cdot \cos y} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto z \cdot \cos y + \color{blue}{\sin y} \]
          2. *-commutativeN/A

            \[\leadsto \cos y \cdot z + \sin \color{blue}{y} \]
          3. lower-fma.f64N/A

            \[\leadsto \mathsf{fma}\left(\cos y, \color{blue}{z}, \sin y\right) \]
          4. lift-cos.f64N/A

            \[\leadsto \mathsf{fma}\left(\cos y, z, \sin y\right) \]
          5. lift-sin.f6495.3

            \[\leadsto \mathsf{fma}\left(\cos y, z, \sin y\right) \]
        4. Applied rewrites95.3%

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

          \[\leadsto \sin y \]
        6. Step-by-step derivation
          1. lift-sin.f6492.2

            \[\leadsto \sin y \]
        7. Applied rewrites92.2%

          \[\leadsto \sin y \]

        if -0.050000000000000003 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1.00000000000000004e-10

        1. Initial program 100.0%

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

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

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

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

            \[\leadsto \left(z + y\right) + x \]
          4. lower-+.f6498.1

            \[\leadsto \left(z + y\right) + x \]
        4. Applied rewrites98.1%

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

      Alternative 7: 70.0% accurate, 2.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{+42}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;y \leq 3300:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z\right) + x\\ \mathbf{else}:\\ \;\;\;\;z + x\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (<= y -1.9e+42)
         (+ z x)
         (if (<= y 3300.0)
           (+ (fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y z) x)
           (+ z x))))
      double code(double x, double y, double z) {
      	double tmp;
      	if (y <= -1.9e+42) {
      		tmp = z + x;
      	} else if (y <= 3300.0) {
      		tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, z) + x;
      	} else {
      		tmp = z + x;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	tmp = 0.0
      	if (y <= -1.9e+42)
      		tmp = Float64(z + x);
      	elseif (y <= 3300.0)
      		tmp = Float64(fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, z) + x);
      	else
      		tmp = Float64(z + x);
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := If[LessEqual[y, -1.9e+42], N[(z + x), $MachinePrecision], If[LessEqual[y, 3300.0], N[(N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + z), $MachinePrecision] + x), $MachinePrecision], N[(z + x), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -1.9 \cdot 10^{+42}:\\
      \;\;\;\;z + x\\
      
      \mathbf{elif}\;y \leq 3300:\\
      \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z\right) + x\\
      
      \mathbf{else}:\\
      \;\;\;\;z + x\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -1.8999999999999999e42 or 3300 < y

        1. Initial program 99.8%

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

          \[\leadsto \color{blue}{x + z} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto z + \color{blue}{x} \]
          2. lower-+.f6440.8

            \[\leadsto z + \color{blue}{x} \]
        4. Applied rewrites40.8%

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

        if -1.8999999999999999e42 < y < 3300

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, y, \frac{-1}{2} \cdot z\right), y, 1\right), y, z\right) + x \]
          11. lower-*.f6494.8

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z\right) + x \]
        4. Applied rewrites94.8%

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

      Alternative 8: 70.0% accurate, 3.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.9 \cdot 10^{+103}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;y \leq 3300:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z \cdot y, -0.5, 1\right), y, z + x\right)\\ \mathbf{else}:\\ \;\;\;\;z + x\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (<= y -4.9e+103)
         (+ z x)
         (if (<= y 3300.0) (fma (fma (* z y) -0.5 1.0) y (+ z x)) (+ z x))))
      double code(double x, double y, double z) {
      	double tmp;
      	if (y <= -4.9e+103) {
      		tmp = z + x;
      	} else if (y <= 3300.0) {
      		tmp = fma(fma((z * y), -0.5, 1.0), y, (z + x));
      	} else {
      		tmp = z + x;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	tmp = 0.0
      	if (y <= -4.9e+103)
      		tmp = Float64(z + x);
      	elseif (y <= 3300.0)
      		tmp = fma(fma(Float64(z * y), -0.5, 1.0), y, Float64(z + x));
      	else
      		tmp = Float64(z + x);
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := If[LessEqual[y, -4.9e+103], N[(z + x), $MachinePrecision], If[LessEqual[y, 3300.0], N[(N[(N[(z * y), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -4.9 \cdot 10^{+103}:\\
      \;\;\;\;z + x\\
      
      \mathbf{elif}\;y \leq 3300:\\
      \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z \cdot y, -0.5, 1\right), y, z + x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;z + x\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -4.8999999999999999e103 or 3300 < y

        1. Initial program 99.8%

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

          \[\leadsto \color{blue}{x + z} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto z + \color{blue}{x} \]
          2. lower-+.f6440.8

            \[\leadsto z + \color{blue}{x} \]
        4. Applied rewrites40.8%

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

        if -4.8999999999999999e103 < y < 3300

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(y \cdot z, \frac{-1}{2}, 1\right), y, x + z\right) \]
          10. *-commutativeN/A

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

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

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z \cdot y, \frac{-1}{2}, 1\right), y, z + x\right) \]
          13. lower-+.f6488.5

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(z \cdot y, -0.5, 1\right), y, z + x\right) \]
        4. Applied rewrites88.5%

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

      Alternative 9: 69.0% accurate, 5.2× speedup?

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

        1. Initial program 99.8%

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

          \[\leadsto \color{blue}{x + z} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto z + \color{blue}{x} \]
          2. lower-+.f6441.0

            \[\leadsto z + \color{blue}{x} \]
        4. Applied rewrites41.0%

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

        if -2.5e19 < y < 1.12e27

        1. Initial program 100.0%

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

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

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

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

            \[\leadsto \left(z + y\right) + x \]
          4. lower-+.f6495.0

            \[\leadsto \left(z + y\right) + x \]
        4. Applied rewrites95.0%

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

      Alternative 10: 67.4% accurate, 6.4× speedup?

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

        1. Initial program 99.9%

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

          \[\leadsto \color{blue}{x + z} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto z + \color{blue}{x} \]
          2. lower-+.f6480.4

            \[\leadsto z + \color{blue}{x} \]
        4. Applied rewrites80.4%

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

        if -2.6000000000000001e-50 < x < 1.30000000000000003e-97

        1. Initial program 99.9%

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

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

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

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

            \[\leadsto \left(z + y\right) + x \]
          4. lower-+.f6451.3

            \[\leadsto \left(z + y\right) + x \]
        4. Applied rewrites51.3%

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

          \[\leadsto y + \color{blue}{z} \]
        6. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto z + y \]
          2. lift-+.f6446.5

            \[\leadsto z + y \]
        7. Applied rewrites46.5%

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

      Alternative 11: 57.0% accurate, 6.4× speedup?

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

        1. Initial program 100.0%

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

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

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

          if -9.99999999999999971e-29 < x < 5.2000000000000004e77

          1. Initial program 99.9%

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

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

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

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

              \[\leadsto \left(z + y\right) + x \]
            4. lower-+.f6451.6

              \[\leadsto \left(z + y\right) + x \]
          4. Applied rewrites51.6%

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

            \[\leadsto y + \color{blue}{z} \]
          6. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto z + y \]
            2. lift-+.f6441.8

              \[\leadsto z + y \]
          7. Applied rewrites41.8%

            \[\leadsto z + \color{blue}{y} \]
        4. Recombined 2 regimes into one program.
        5. Add Preprocessing

        Alternative 12: 53.6% accurate, 8.5× speedup?

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

          1. Initial program 100.0%

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

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

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

            if -9.99999999999999971e-29 < x < 5.2000000000000004e77

            1. Initial program 99.9%

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

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

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

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

                \[\leadsto \left(z + y\right) + x \]
              4. lower-+.f6451.6

                \[\leadsto \left(z + y\right) + x \]
            4. Applied rewrites51.6%

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

              \[\leadsto z \]
            6. Step-by-step derivation
              1. Applied rewrites35.6%

                \[\leadsto z \]
            7. Recombined 2 regimes into one program.
            8. Add Preprocessing

            Alternative 13: 44.3% accurate, 8.5× speedup?

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

              1. Initial program 99.9%

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

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

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

                if -1.49999999999999995e-50 < x < 1.30000000000000003e-97

                1. Initial program 99.9%

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

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

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

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

                    \[\leadsto \left(z + y\right) + x \]
                  4. lower-+.f6451.3

                    \[\leadsto \left(z + y\right) + x \]
                4. Applied rewrites51.3%

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

                  \[\leadsto y \]
                6. Step-by-step derivation
                  1. Applied rewrites12.2%

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

                Alternative 14: 42.2% accurate, 73.1× speedup?

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

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

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

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

                  Reproduce

                  ?
                  herbie shell --seed 2025110 
                  (FPCore (x y z)
                    :name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
                    :precision binary64
                    (+ (+ x (sin y)) (* z (cos y))))