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

Percentage Accurate: 99.9% → 99.9%
Time: 8.6s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\left(x + \sin y\right) + z \cdot \cos y \]
(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]
\left(x + \sin y\right) + z \cdot \cos y

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 10 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?

\[\left(x + \sin y\right) + z \cdot \cos y \]
(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]
\left(x + \sin y\right) + z \cdot \cos y

Alternative 1: 89.0% accurate, 0.9× speedup?

\[\begin{array}{l} t_0 := \left(x + \sin y\right) + z\\ t_1 := z \cdot \cos y\\ \mathbf{if}\;x \leq -25000000000000001224418164378763014489305675088268597218626059364754206589834618904030788231181911594827826617037756919051335822966564630427556904960:\\ \;\;\;\;\left(x + y\right) + t\_1\\ \mathbf{elif}\;x \leq \frac{-1436010445571041}{4951760157141521099596496896}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq \frac{2785010123894805}{1989292945639146568621528992587283360401824603189390869761855907572637988050133502132224}:\\ \;\;\;\;\sin y + t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (let* ((t_0 (+ (+ x (sin y)) z)) (t_1 (* z (cos y))))
  (if (<=
       x
       -25000000000000001224418164378763014489305675088268597218626059364754206589834618904030788231181911594827826617037756919051335822966564630427556904960)
    (+ (+ x y) t_1)
    (if (<= x -1436010445571041/4951760157141521099596496896)
      t_0
      (if (<=
           x
           2785010123894805/1989292945639146568621528992587283360401824603189390869761855907572637988050133502132224)
        (+ (sin y) t_1)
        t_0)))))
double code(double x, double y, double z) {
	double t_0 = (x + sin(y)) + z;
	double t_1 = z * cos(y);
	double tmp;
	if (x <= -2.5e+148) {
		tmp = (x + y) + t_1;
	} else if (x <= -2.9e-13) {
		tmp = t_0;
	} else if (x <= 1.4e-72) {
		tmp = sin(y) + t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = (x + sin(y)) + z
    t_1 = z * cos(y)
    if (x <= (-2.5d+148)) then
        tmp = (x + y) + t_1
    else if (x <= (-2.9d-13)) then
        tmp = t_0
    else if (x <= 1.4d-72) then
        tmp = sin(y) + t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x + Math.sin(y)) + z;
	double t_1 = z * Math.cos(y);
	double tmp;
	if (x <= -2.5e+148) {
		tmp = (x + y) + t_1;
	} else if (x <= -2.9e-13) {
		tmp = t_0;
	} else if (x <= 1.4e-72) {
		tmp = Math.sin(y) + t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + math.sin(y)) + z
	t_1 = z * math.cos(y)
	tmp = 0
	if x <= -2.5e+148:
		tmp = (x + y) + t_1
	elif x <= -2.9e-13:
		tmp = t_0
	elif x <= 1.4e-72:
		tmp = math.sin(y) + t_1
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x + sin(y)) + z)
	t_1 = Float64(z * cos(y))
	tmp = 0.0
	if (x <= -2.5e+148)
		tmp = Float64(Float64(x + y) + t_1);
	elseif (x <= -2.9e-13)
		tmp = t_0;
	elseif (x <= 1.4e-72)
		tmp = Float64(sin(y) + t_1);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x + sin(y)) + z;
	t_1 = z * cos(y);
	tmp = 0.0;
	if (x <= -2.5e+148)
		tmp = (x + y) + t_1;
	elseif (x <= -2.9e-13)
		tmp = t_0;
	elseif (x <= 1.4e-72)
		tmp = sin(y) + t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -25000000000000001224418164378763014489305675088268597218626059364754206589834618904030788231181911594827826617037756919051335822966564630427556904960], N[(N[(x + y), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[x, -1436010445571041/4951760157141521099596496896], t$95$0, If[LessEqual[x, 2785010123894805/1989292945639146568621528992587283360401824603189390869761855907572637988050133502132224], N[(N[Sin[y], $MachinePrecision] + t$95$1), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
t_0 := \left(x + \sin y\right) + z\\
t_1 := z \cdot \cos y\\
\mathbf{if}\;x \leq -25000000000000001224418164378763014489305675088268597218626059364754206589834618904030788231181911594827826617037756919051335822966564630427556904960:\\
\;\;\;\;\left(x + y\right) + t\_1\\

\mathbf{elif}\;x \leq \frac{-1436010445571041}{4951760157141521099596496896}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq \frac{2785010123894805}{1989292945639146568621528992587283360401824603189390869761855907572637988050133502132224}:\\
\;\;\;\;\sin y + t\_1\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.5000000000000001e148

    1. Initial program 99.9%

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

      \[\leadsto \color{blue}{\left(x + y\right)} + z \cdot \cos y \]
    3. Step-by-step derivation
      1. lower-+.f6470.5%

        \[\leadsto \left(x + \color{blue}{y}\right) + z \cdot \cos y \]
    4. Applied rewrites70.5%

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

    if -2.5000000000000001e148 < x < -2.8999999999999998e-13 or 1.3999999999999999e-72 < x

    1. Initial program 99.9%

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

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

        \[\leadsto \left(x + \sin y\right) + \color{blue}{z} \]

      if -2.8999999999999998e-13 < x < 1.3999999999999999e-72

      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. lower-sin.f6458.6%

          \[\leadsto \sin y + z \cdot \cos y \]
      4. Applied rewrites58.6%

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

    Alternative 2: 88.7% accurate, 1.7× speedup?

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

      1. Initial program 99.9%

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

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

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

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

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

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

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

          \[\leadsto z \cdot \left(\cos y + \left(\frac{x}{z} + \frac{\sin y}{\color{blue}{z}}\right)\right) \]
        7. lower-sin.f6487.9%

          \[\leadsto z \cdot \left(\cos y + \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
      4. Applied rewrites87.9%

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

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

          \[\leadsto z \cdot \left(\left(\frac{x}{z} + \frac{\sin y}{z}\right) + \color{blue}{\cos y}\right) \]
        3. sum-to-multN/A

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \color{blue}{\left(\frac{x}{z} + \frac{\sin y}{z}\right)}\right) \]
        4. lower-unsound-*.f64N/A

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

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\color{blue}{\frac{x}{z}} + \frac{\sin y}{z}\right)\right) \]
        6. lower-unsound-/.f6483.9%

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

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
        8. lift-/.f64N/A

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
        9. lift-/.f64N/A

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
        10. div-add-revN/A

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
        11. lift-+.f64N/A

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
        12. lower-/.f6483.8%

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
        13. lift-+.f64N/A

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
        14. +-commutativeN/A

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
        15. lower-+.f6483.8%

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
        16. lift-+.f64N/A

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \color{blue}{\frac{\sin y}{z}}\right)\right) \]
        17. lift-/.f64N/A

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\color{blue}{\sin y}}{z}\right)\right) \]
        18. lift-/.f64N/A

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{\color{blue}{z}}\right)\right) \]
        19. div-add-revN/A

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \frac{x + \sin y}{\color{blue}{z}}\right) \]
      6. Applied rewrites83.9%

        \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \color{blue}{\frac{\sin y + x}{z}}\right) \]
      7. Taylor expanded in z around inf

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

          \[\leadsto z \cdot \cos y \]
        2. lower-cos.f6442.4%

          \[\leadsto z \cdot \cos y \]
      9. Applied rewrites42.4%

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

      if -4.5e52 < z < 1.9500000000000001e44

      1. Initial program 99.9%

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

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

          \[\leadsto \left(x + \sin y\right) + \color{blue}{z} \]

        if 1.9500000000000001e44 < z

        1. Initial program 99.9%

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

          \[\leadsto \color{blue}{\left(x + y\right)} + z \cdot \cos y \]
        3. Step-by-step derivation
          1. lower-+.f6470.5%

            \[\leadsto \left(x + \color{blue}{y}\right) + z \cdot \cos y \]
        4. Applied rewrites70.5%

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

      Alternative 3: 88.6% accurate, 1.8× speedup?

      \[\begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -44999999999999999694942690346273258940776879887482880:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 900000000000000042038738549023005289861289802492459741531608433724750463326305802962540899773738019948769863095006895570489159275084260631696359380724753273726825992370916201716464484352:\\ \;\;\;\;\left(x + \sin y\right) + z\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
      (FPCore (x y z)
        :precision binary64
        (let* ((t_0 (* z (cos y))))
        (if (<= z -44999999999999999694942690346273258940776879887482880)
          t_0
          (if (<=
               z
               900000000000000042038738549023005289861289802492459741531608433724750463326305802962540899773738019948769863095006895570489159275084260631696359380724753273726825992370916201716464484352)
            (+ (+ x (sin y)) z)
            t_0))))
      double code(double x, double y, double z) {
      	double t_0 = z * cos(y);
      	double tmp;
      	if (z <= -4.5e+52) {
      		tmp = t_0;
      	} else if (z <= 9e+185) {
      		tmp = (x + sin(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 = z * cos(y)
          if (z <= (-4.5d+52)) then
              tmp = t_0
          else if (z <= 9d+185) then
              tmp = (x + sin(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 = z * Math.cos(y);
      	double tmp;
      	if (z <= -4.5e+52) {
      		tmp = t_0;
      	} else if (z <= 9e+185) {
      		tmp = (x + Math.sin(y)) + z;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = z * math.cos(y)
      	tmp = 0
      	if z <= -4.5e+52:
      		tmp = t_0
      	elif z <= 9e+185:
      		tmp = (x + math.sin(y)) + z
      	else:
      		tmp = t_0
      	return tmp
      
      function code(x, y, z)
      	t_0 = Float64(z * cos(y))
      	tmp = 0.0
      	if (z <= -4.5e+52)
      		tmp = t_0;
      	elseif (z <= 9e+185)
      		tmp = Float64(Float64(x + sin(y)) + z);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = z * cos(y);
      	tmp = 0.0;
      	if (z <= -4.5e+52)
      		tmp = t_0;
      	elseif (z <= 9e+185)
      		tmp = (x + sin(y)) + z;
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -44999999999999999694942690346273258940776879887482880], t$95$0, If[LessEqual[z, 900000000000000042038738549023005289861289802492459741531608433724750463326305802962540899773738019948769863095006895570489159275084260631696359380724753273726825992370916201716464484352], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      t_0 := z \cdot \cos y\\
      \mathbf{if}\;z \leq -44999999999999999694942690346273258940776879887482880:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;z \leq 900000000000000042038738549023005289861289802492459741531608433724750463326305802962540899773738019948769863095006895570489159275084260631696359380724753273726825992370916201716464484352:\\
      \;\;\;\;\left(x + \sin y\right) + z\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < -4.5e52 or 9.0000000000000004e185 < z

        1. Initial program 99.9%

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

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

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

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

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

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

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

            \[\leadsto z \cdot \left(\cos y + \left(\frac{x}{z} + \frac{\sin y}{\color{blue}{z}}\right)\right) \]
          7. lower-sin.f6487.9%

            \[\leadsto z \cdot \left(\cos y + \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
        4. Applied rewrites87.9%

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

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

            \[\leadsto z \cdot \left(\left(\frac{x}{z} + \frac{\sin y}{z}\right) + \color{blue}{\cos y}\right) \]
          3. sum-to-multN/A

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \color{blue}{\left(\frac{x}{z} + \frac{\sin y}{z}\right)}\right) \]
          4. lower-unsound-*.f64N/A

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

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\color{blue}{\frac{x}{z}} + \frac{\sin y}{z}\right)\right) \]
          6. lower-unsound-/.f6483.9%

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

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
          8. lift-/.f64N/A

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
          9. lift-/.f64N/A

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
          10. div-add-revN/A

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
          11. lift-+.f64N/A

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
          12. lower-/.f6483.8%

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
          13. lift-+.f64N/A

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
          14. +-commutativeN/A

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
          15. lower-+.f6483.8%

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
          16. lift-+.f64N/A

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \color{blue}{\frac{\sin y}{z}}\right)\right) \]
          17. lift-/.f64N/A

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\color{blue}{\sin y}}{z}\right)\right) \]
          18. lift-/.f64N/A

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{\color{blue}{z}}\right)\right) \]
          19. div-add-revN/A

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \frac{x + \sin y}{\color{blue}{z}}\right) \]
        6. Applied rewrites83.9%

          \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \color{blue}{\frac{\sin y + x}{z}}\right) \]
        7. Taylor expanded in z around inf

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

            \[\leadsto z \cdot \cos y \]
          2. lower-cos.f6442.4%

            \[\leadsto z \cdot \cos y \]
        9. Applied rewrites42.4%

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

        if -4.5e52 < z < 9.0000000000000004e185

        1. Initial program 99.9%

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

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

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

        Alternative 4: 73.0% accurate, 1.8× speedup?

        \[\begin{array}{l} \mathbf{if}\;x \leq \frac{-1436010445571041}{4951760157141521099596496896}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq \frac{2785010123894805}{1989292945639146568621528992587283360401824603189390869761855907572637988050133502132224}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
        (FPCore (x y z)
          :precision binary64
          (if (<= x -1436010445571041/4951760157141521099596496896)
          (+ x z)
          (if (<=
               x
               2785010123894805/1989292945639146568621528992587283360401824603189390869761855907572637988050133502132224)
            (* z (cos y))
            (+ x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (x <= -2.9e-13) {
        		tmp = x + z;
        	} else if (x <= 1.4e-72) {
        		tmp = z * cos(y);
        	} else {
        		tmp = 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 (x <= (-2.9d-13)) then
                tmp = x + z
            else if (x <= 1.4d-72) then
                tmp = z * cos(y)
            else
                tmp = x + z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (x <= -2.9e-13) {
        		tmp = x + z;
        	} else if (x <= 1.4e-72) {
        		tmp = z * Math.cos(y);
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if x <= -2.9e-13:
        		tmp = x + z
        	elif x <= 1.4e-72:
        		tmp = z * math.cos(y)
        	else:
        		tmp = x + z
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (x <= -2.9e-13)
        		tmp = Float64(x + z);
        	elseif (x <= 1.4e-72)
        		tmp = Float64(z * cos(y));
        	else
        		tmp = Float64(x + z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (x <= -2.9e-13)
        		tmp = x + z;
        	elseif (x <= 1.4e-72)
        		tmp = z * cos(y);
        	else
        		tmp = x + z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[x, -1436010445571041/4951760157141521099596496896], N[(x + z), $MachinePrecision], If[LessEqual[x, 2785010123894805/1989292945639146568621528992587283360401824603189390869761855907572637988050133502132224], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
        
        \begin{array}{l}
        \mathbf{if}\;x \leq \frac{-1436010445571041}{4951760157141521099596496896}:\\
        \;\;\;\;x + z\\
        
        \mathbf{elif}\;x \leq \frac{2785010123894805}{1989292945639146568621528992587283360401824603189390869761855907572637988050133502132224}:\\
        \;\;\;\;z \cdot \cos y\\
        
        \mathbf{else}:\\
        \;\;\;\;x + z\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < -2.8999999999999998e-13 or 1.3999999999999999e-72 < 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. lower-+.f6465.9%

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

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

          if -2.8999999999999998e-13 < x < 1.3999999999999999e-72

          1. Initial program 99.9%

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

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

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

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

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

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

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

              \[\leadsto z \cdot \left(\cos y + \left(\frac{x}{z} + \frac{\sin y}{\color{blue}{z}}\right)\right) \]
            7. lower-sin.f6487.9%

              \[\leadsto z \cdot \left(\cos y + \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
          4. Applied rewrites87.9%

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

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

              \[\leadsto z \cdot \left(\left(\frac{x}{z} + \frac{\sin y}{z}\right) + \color{blue}{\cos y}\right) \]
            3. sum-to-multN/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \color{blue}{\left(\frac{x}{z} + \frac{\sin y}{z}\right)}\right) \]
            4. lower-unsound-*.f64N/A

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

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\color{blue}{\frac{x}{z}} + \frac{\sin y}{z}\right)\right) \]
            6. lower-unsound-/.f6483.9%

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

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            8. lift-/.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            9. lift-/.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            10. div-add-revN/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            11. lift-+.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            12. lower-/.f6483.8%

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            13. lift-+.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            14. +-commutativeN/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            15. lower-+.f6483.8%

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            16. lift-+.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \color{blue}{\frac{\sin y}{z}}\right)\right) \]
            17. lift-/.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\color{blue}{\sin y}}{z}\right)\right) \]
            18. lift-/.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{\color{blue}{z}}\right)\right) \]
            19. div-add-revN/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \frac{x + \sin y}{\color{blue}{z}}\right) \]
          6. Applied rewrites83.9%

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \color{blue}{\frac{\sin y + x}{z}}\right) \]
          7. Taylor expanded in z around inf

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

              \[\leadsto z \cdot \cos y \]
            2. lower-cos.f6442.4%

              \[\leadsto z \cdot \cos y \]
          9. Applied rewrites42.4%

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

        Alternative 5: 70.4% accurate, 4.7× speedup?

        \[\begin{array}{l} \mathbf{if}\;y \leq -122:\\ \;\;\;\;\left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{x - z}\right)\\ \mathbf{elif}\;y \leq 65000000000:\\ \;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(\frac{-1}{2} \cdot z + \frac{-1}{6} \cdot y\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
        (FPCore (x y z)
          :precision binary64
          (if (<= y -122)
          (* (+ z x) (* (- z x) (/ -1 (- x z))))
          (if (<= y 65000000000)
            (+ x (+ z (* y (+ 1 (* y (+ (* -1/2 z) (* -1/6 y)))))))
            (+ x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -122.0) {
        		tmp = (z + x) * ((z - x) * (-1.0 / (x - z)));
        	} else if (y <= 65000000000.0) {
        		tmp = x + (z + (y * (1.0 + (y * ((-0.5 * z) + (-0.16666666666666666 * y))))));
        	} else {
        		tmp = 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 (y <= (-122.0d0)) then
                tmp = (z + x) * ((z - x) * ((-1.0d0) / (x - z)))
            else if (y <= 65000000000.0d0) then
                tmp = x + (z + (y * (1.0d0 + (y * (((-0.5d0) * z) + ((-0.16666666666666666d0) * y))))))
            else
                tmp = x + z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -122.0) {
        		tmp = (z + x) * ((z - x) * (-1.0 / (x - z)));
        	} else if (y <= 65000000000.0) {
        		tmp = x + (z + (y * (1.0 + (y * ((-0.5 * z) + (-0.16666666666666666 * y))))));
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= -122.0:
        		tmp = (z + x) * ((z - x) * (-1.0 / (x - z)))
        	elif y <= 65000000000.0:
        		tmp = x + (z + (y * (1.0 + (y * ((-0.5 * z) + (-0.16666666666666666 * y))))))
        	else:
        		tmp = x + z
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -122.0)
        		tmp = Float64(Float64(z + x) * Float64(Float64(z - x) * Float64(-1.0 / Float64(x - z))));
        	elseif (y <= 65000000000.0)
        		tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * Float64(Float64(-0.5 * z) + Float64(-0.16666666666666666 * y)))))));
        	else
        		tmp = Float64(x + z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (y <= -122.0)
        		tmp = (z + x) * ((z - x) * (-1.0 / (x - z)));
        	elseif (y <= 65000000000.0)
        		tmp = x + (z + (y * (1.0 + (y * ((-0.5 * z) + (-0.16666666666666666 * y))))));
        	else
        		tmp = x + z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -122], N[(N[(z + x), $MachinePrecision] * N[(N[(z - x), $MachinePrecision] * N[(-1 / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 65000000000], N[(x + N[(z + N[(y * N[(1 + N[(y * N[(N[(-1/2 * z), $MachinePrecision] + N[(-1/6 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
        
        \begin{array}{l}
        \mathbf{if}\;y \leq -122:\\
        \;\;\;\;\left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{x - z}\right)\\
        
        \mathbf{elif}\;y \leq 65000000000:\\
        \;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \left(\frac{-1}{2} \cdot z + \frac{-1}{6} \cdot y\right)\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x + z\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y < -122

          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. lower-+.f6465.9%

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

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

              \[\leadsto x + \color{blue}{z} \]
            2. +-commutativeN/A

              \[\leadsto z + \color{blue}{x} \]
            3. flip-+N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{\color{blue}{z - x}} \]
            4. lower-unsound-/.f64N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{\color{blue}{z - x}} \]
            5. lower-unsound-*.f32N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{z - x} \]
            6. lower-*.f32N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{z - x} \]
            7. lower-unsound--.f64N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{\color{blue}{z} - x} \]
            8. lower-*.f64N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{z - x} \]
            9. lower-unsound-*.f64N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{z - x} \]
            10. lower-unsound--.f6433.0%

              \[\leadsto \frac{z \cdot z - x \cdot x}{z - \color{blue}{x}} \]
          6. Applied rewrites33.0%

            \[\leadsto \frac{z \cdot z - x \cdot x}{\color{blue}{z - x}} \]
          7. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{\color{blue}{z - x}} \]
            2. mult-flipN/A

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

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

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

              \[\leadsto \left(z \cdot z - x \cdot x\right) \cdot \frac{1}{z - x} \]
            6. difference-of-squaresN/A

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{\mathsf{neg}\left(-1\right)}{z - \color{blue}{x}}\right) \]
            16. sub-negate-revN/A

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(\left(x - z\right)\right)}\right) \]
            17. frac-2neg-revN/A

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{\color{blue}{x - z}}\right) \]
            18. sub-negate-revN/A

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{\mathsf{neg}\left(\left(z - x\right)\right)}\right) \]
            19. lift--.f64N/A

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{\mathsf{neg}\left(\left(z - x\right)\right)}\right) \]
            20. lower-/.f64N/A

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

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{\mathsf{neg}\left(\left(z - x\right)\right)}\right) \]
            22. sub-negate-revN/A

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{x - \color{blue}{z}}\right) \]
            23. lower--.f6465.8%

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{x - \color{blue}{z}}\right) \]
          8. Applied rewrites65.8%

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

          if -122 < y < 6.5e10

          1. Initial program 99.9%

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

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

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

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

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

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

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

              \[\leadsto z \cdot \left(\cos y + \left(\frac{x}{z} + \frac{\sin y}{\color{blue}{z}}\right)\right) \]
            7. lower-sin.f6487.9%

              \[\leadsto z \cdot \left(\cos y + \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
          4. Applied rewrites87.9%

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

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

              \[\leadsto z \cdot \left(\left(\frac{x}{z} + \frac{\sin y}{z}\right) + \color{blue}{\cos y}\right) \]
            3. sum-to-multN/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \color{blue}{\left(\frac{x}{z} + \frac{\sin y}{z}\right)}\right) \]
            4. lower-unsound-*.f64N/A

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

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\color{blue}{\frac{x}{z}} + \frac{\sin y}{z}\right)\right) \]
            6. lower-unsound-/.f6483.9%

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

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            8. lift-/.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            9. lift-/.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x}{z} + \frac{\sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            10. div-add-revN/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            11. lift-+.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            12. lower-/.f6483.8%

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            13. lift-+.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{x + \sin y}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            14. +-commutativeN/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            15. lower-+.f6483.8%

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{z}\right)\right) \]
            16. lift-+.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \color{blue}{\frac{\sin y}{z}}\right)\right) \]
            17. lift-/.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\color{blue}{\sin y}}{z}\right)\right) \]
            18. lift-/.f64N/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \left(\frac{x}{z} + \frac{\sin y}{\color{blue}{z}}\right)\right) \]
            19. div-add-revN/A

              \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \frac{x + \sin y}{\color{blue}{z}}\right) \]
          6. Applied rewrites83.9%

            \[\leadsto z \cdot \left(\left(1 + \frac{\cos y}{\frac{\sin y + x}{z}}\right) \cdot \color{blue}{\frac{\sin y + x}{z}}\right) \]
          7. 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)} \]
          8. Step-by-step derivation
            1. lower-+.f64N/A

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

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

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

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

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

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

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

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

          if 6.5e10 < 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. lower-+.f6465.9%

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

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

        Alternative 6: 70.2% accurate, 5.7× speedup?

        \[\begin{array}{l} \mathbf{if}\;y \leq -122:\\ \;\;\;\;\left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{x - z}\right)\\ \mathbf{elif}\;y \leq \frac{4457913959828945}{151115727451828646838272}:\\ \;\;\;\;x + \left(z + y \cdot \left(1 + \frac{-1}{2} \cdot \left(y \cdot z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
        (FPCore (x y z)
          :precision binary64
          (if (<= y -122)
          (* (+ z x) (* (- z x) (/ -1 (- x z))))
          (if (<= y 4457913959828945/151115727451828646838272)
            (+ x (+ z (* y (+ 1 (* -1/2 (* y z))))))
            (+ x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -122.0) {
        		tmp = (z + x) * ((z - x) * (-1.0 / (x - z)));
        	} else if (y <= 2.95e-8) {
        		tmp = x + (z + (y * (1.0 + (-0.5 * (y * z)))));
        	} else {
        		tmp = 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 (y <= (-122.0d0)) then
                tmp = (z + x) * ((z - x) * ((-1.0d0) / (x - z)))
            else if (y <= 2.95d-8) then
                tmp = x + (z + (y * (1.0d0 + ((-0.5d0) * (y * z)))))
            else
                tmp = x + z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -122.0) {
        		tmp = (z + x) * ((z - x) * (-1.0 / (x - z)));
        	} else if (y <= 2.95e-8) {
        		tmp = x + (z + (y * (1.0 + (-0.5 * (y * z)))));
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= -122.0:
        		tmp = (z + x) * ((z - x) * (-1.0 / (x - z)))
        	elif y <= 2.95e-8:
        		tmp = x + (z + (y * (1.0 + (-0.5 * (y * z)))))
        	else:
        		tmp = x + z
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -122.0)
        		tmp = Float64(Float64(z + x) * Float64(Float64(z - x) * Float64(-1.0 / Float64(x - z))));
        	elseif (y <= 2.95e-8)
        		tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(y * z))))));
        	else
        		tmp = Float64(x + z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (y <= -122.0)
        		tmp = (z + x) * ((z - x) * (-1.0 / (x - z)));
        	elseif (y <= 2.95e-8)
        		tmp = x + (z + (y * (1.0 + (-0.5 * (y * z)))));
        	else
        		tmp = x + z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -122], N[(N[(z + x), $MachinePrecision] * N[(N[(z - x), $MachinePrecision] * N[(-1 / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4457913959828945/151115727451828646838272], N[(x + N[(z + N[(y * N[(1 + N[(-1/2 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
        
        \begin{array}{l}
        \mathbf{if}\;y \leq -122:\\
        \;\;\;\;\left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{x - z}\right)\\
        
        \mathbf{elif}\;y \leq \frac{4457913959828945}{151115727451828646838272}:\\
        \;\;\;\;x + \left(z + y \cdot \left(1 + \frac{-1}{2} \cdot \left(y \cdot z\right)\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x + z\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y < -122

          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. lower-+.f6465.9%

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

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

              \[\leadsto x + \color{blue}{z} \]
            2. +-commutativeN/A

              \[\leadsto z + \color{blue}{x} \]
            3. flip-+N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{\color{blue}{z - x}} \]
            4. lower-unsound-/.f64N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{\color{blue}{z - x}} \]
            5. lower-unsound-*.f32N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{z - x} \]
            6. lower-*.f32N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{z - x} \]
            7. lower-unsound--.f64N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{\color{blue}{z} - x} \]
            8. lower-*.f64N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{z - x} \]
            9. lower-unsound-*.f64N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{z - x} \]
            10. lower-unsound--.f6433.0%

              \[\leadsto \frac{z \cdot z - x \cdot x}{z - \color{blue}{x}} \]
          6. Applied rewrites33.0%

            \[\leadsto \frac{z \cdot z - x \cdot x}{\color{blue}{z - x}} \]
          7. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \frac{z \cdot z - x \cdot x}{\color{blue}{z - x}} \]
            2. mult-flipN/A

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

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

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

              \[\leadsto \left(z \cdot z - x \cdot x\right) \cdot \frac{1}{z - x} \]
            6. difference-of-squaresN/A

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{\mathsf{neg}\left(-1\right)}{z - \color{blue}{x}}\right) \]
            16. sub-negate-revN/A

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(\left(x - z\right)\right)}\right) \]
            17. frac-2neg-revN/A

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{\color{blue}{x - z}}\right) \]
            18. sub-negate-revN/A

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{\mathsf{neg}\left(\left(z - x\right)\right)}\right) \]
            19. lift--.f64N/A

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{\mathsf{neg}\left(\left(z - x\right)\right)}\right) \]
            20. lower-/.f64N/A

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

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{\mathsf{neg}\left(\left(z - x\right)\right)}\right) \]
            22. sub-negate-revN/A

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{x - \color{blue}{z}}\right) \]
            23. lower--.f6465.8%

              \[\leadsto \left(z + x\right) \cdot \left(\left(z - x\right) \cdot \frac{-1}{x - \color{blue}{z}}\right) \]
          8. Applied rewrites65.8%

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

          if -122 < y < 2.9499999999999999e-8

          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(z + y \cdot \left(1 + \frac{-1}{2} \cdot \left(y \cdot z\right)\right)\right)} \]
          3. Step-by-step derivation
            1. lower-+.f64N/A

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

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

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

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

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

              \[\leadsto x + \left(z + y \cdot \left(1 + \frac{-1}{2} \cdot \left(y \cdot \color{blue}{z}\right)\right)\right) \]
          4. Applied rewrites56.9%

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

          if 2.9499999999999999e-8 < 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. lower-+.f6465.9%

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

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

        Alternative 7: 70.2% accurate, 5.7× speedup?

        \[\begin{array}{l} \mathbf{if}\;y \leq -122:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq \frac{4457913959828945}{151115727451828646838272}:\\ \;\;\;\;x + \left(z + y \cdot \left(1 + \frac{-1}{2} \cdot \left(y \cdot z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
        (FPCore (x y z)
          :precision binary64
          (if (<= y -122)
          (+ x z)
          (if (<= y 4457913959828945/151115727451828646838272)
            (+ x (+ z (* y (+ 1 (* -1/2 (* y z))))))
            (+ x z))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -122.0) {
        		tmp = x + z;
        	} else if (y <= 2.95e-8) {
        		tmp = x + (z + (y * (1.0 + (-0.5 * (y * z)))));
        	} else {
        		tmp = 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 (y <= (-122.0d0)) then
                tmp = x + z
            else if (y <= 2.95d-8) then
                tmp = x + (z + (y * (1.0d0 + ((-0.5d0) * (y * z)))))
            else
                tmp = x + z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -122.0) {
        		tmp = x + z;
        	} else if (y <= 2.95e-8) {
        		tmp = x + (z + (y * (1.0 + (-0.5 * (y * z)))));
        	} else {
        		tmp = x + z;
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if y <= -122.0:
        		tmp = x + z
        	elif y <= 2.95e-8:
        		tmp = x + (z + (y * (1.0 + (-0.5 * (y * z)))))
        	else:
        		tmp = x + z
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -122.0)
        		tmp = Float64(x + z);
        	elseif (y <= 2.95e-8)
        		tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(y * z))))));
        	else
        		tmp = Float64(x + z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if (y <= -122.0)
        		tmp = x + z;
        	elseif (y <= 2.95e-8)
        		tmp = x + (z + (y * (1.0 + (-0.5 * (y * z)))));
        	else
        		tmp = x + z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -122], N[(x + z), $MachinePrecision], If[LessEqual[y, 4457913959828945/151115727451828646838272], N[(x + N[(z + N[(y * N[(1 + N[(-1/2 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + z), $MachinePrecision]]]
        
        \begin{array}{l}
        \mathbf{if}\;y \leq -122:\\
        \;\;\;\;x + z\\
        
        \mathbf{elif}\;y \leq \frac{4457913959828945}{151115727451828646838272}:\\
        \;\;\;\;x + \left(z + y \cdot \left(1 + \frac{-1}{2} \cdot \left(y \cdot z\right)\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;x + z\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -122 or 2.9499999999999999e-8 < 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. lower-+.f6465.9%

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

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

          if -122 < y < 2.9499999999999999e-8

          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(z + y \cdot \left(1 + \frac{-1}{2} \cdot \left(y \cdot z\right)\right)\right)} \]
          3. Step-by-step derivation
            1. lower-+.f64N/A

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

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

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

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

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

              \[\leadsto x + \left(z + y \cdot \left(1 + \frac{-1}{2} \cdot \left(y \cdot \color{blue}{z}\right)\right)\right) \]
          4. Applied rewrites56.9%

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

        Alternative 8: 65.9% accurate, 53.0× speedup?

        \[x + z \]
        (FPCore (x y z)
          :precision binary64
          (+ x z))
        double code(double x, double y, double z) {
        	return x + 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 + z
        end function
        
        public static double code(double x, double y, double z) {
        	return x + z;
        }
        
        def code(x, y, z):
        	return x + z
        
        function code(x, y, z)
        	return Float64(x + z)
        end
        
        function tmp = code(x, y, z)
        	tmp = x + z;
        end
        
        code[x_, y_, z_] := N[(x + z), $MachinePrecision]
        
        x + z
        
        Derivation
        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. lower-+.f6465.9%

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

          \[\leadsto \color{blue}{x + z} \]
        5. Add Preprocessing

        Alternative 9: 25.8% accurate, 212.0× speedup?

        \[z \]
        (FPCore (x y z)
          :precision binary64
          z)
        double code(double x, double y, double z) {
        	return 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 = z
        end function
        
        public static double code(double x, double y, double z) {
        	return z;
        }
        
        def code(x, y, z):
        	return z
        
        function code(x, y, z)
        	return z
        end
        
        function tmp = code(x, y, z)
        	tmp = z;
        end
        
        code[x_, y_, z_] := z
        
        z
        
        Derivation
        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. lower-+.f6465.9%

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

          \[\leadsto \color{blue}{x + z} \]
        5. Taylor expanded in x around 0

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

            \[\leadsto z \]
          2. Add Preprocessing

          Reproduce

          ?
          herbie shell --seed 2025271 -o generate:evaluate
          (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))))