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

Percentage Accurate: 99.9% → 99.9%
Time: 7.1s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 99.9% accurate, 1.0× speedup?

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

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

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

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

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

Alternative 2: 77.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x + \sin y\right) + z \cdot \cos y\\ \mathbf{if}\;t\_0 \leq -100000 \lor \neg \left(t\_0 \leq 1\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1, z, \sin y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ (+ x (sin y)) (* z (cos y)))))
   (if (or (<= t_0 -100000.0) (not (<= t_0 1.0)))
     (+ z x)
     (fma 1.0 z (sin y)))))
double code(double x, double y, double z) {
	double t_0 = (x + sin(y)) + (z * cos(y));
	double tmp;
	if ((t_0 <= -100000.0) || !(t_0 <= 1.0)) {
		tmp = z + x;
	} else {
		tmp = fma(1.0, z, sin(y));
	}
	return tmp;
}
function code(x, y, z)
	t_0 = Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
	tmp = 0.0
	if ((t_0 <= -100000.0) || !(t_0 <= 1.0))
		tmp = Float64(z + x);
	else
		tmp = fma(1.0, z, sin(y));
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -100000.0], N[Not[LessEqual[t$95$0, 1.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(1.0 * z + N[Sin[y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(x + \sin y\right) + z \cdot \cos y\\
\mathbf{if}\;t\_0 \leq -100000 \lor \neg \left(t\_0 \leq 1\right):\\
\;\;\;\;z + x\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, z, \sin y\right)\\


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

    1. Initial program 99.9%

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

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

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

        \[\leadsto \color{blue}{z + x} \]
    5. Applied rewrites76.8%

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

    if -1e5 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\cos y}, z, \sin y\right) \]
      5. lower-sin.f6491.1

        \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y}\right) \]
    5. Applied rewrites91.1%

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

      \[\leadsto \mathsf{fma}\left(1, z, \sin y\right) \]
    7. Step-by-step derivation
      1. Applied rewrites91.1%

        \[\leadsto \mathsf{fma}\left(1, z, \sin y\right) \]
    8. Recombined 2 regimes into one program.
    9. Final simplification80.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x + \sin y\right) + z \cdot \cos y \leq -100000 \lor \neg \left(\left(x + \sin y\right) + z \cdot \cos y \leq 1\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1, z, \sin y\right)\\ \end{array} \]
    10. Add Preprocessing

    Alternative 3: 70.3% accurate, 0.5× speedup?

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

      1. Initial program 99.9%

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

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

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

          \[\leadsto \color{blue}{z + x} \]
      5. Applied rewrites74.7%

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

      if -0.900000000000000022 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 0.96999999999999997

      1. Initial program 100.0%

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

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

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

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

          \[\leadsto \color{blue}{\left(z + y\right)} + x \]
        4. lower-+.f6459.8

          \[\leadsto \color{blue}{\left(z + y\right)} + x \]
      5. Applied rewrites59.8%

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

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

    Alternative 4: 89.0% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.32 \cdot 10^{+98} \lor \neg \left(z \leq 1.65 \cdot 10^{+176}\right):\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1, z, \sin y + x\right)\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (or (<= z -1.32e+98) (not (<= z 1.65e+176)))
       (fma (cos y) z (sin y))
       (fma 1.0 z (+ (sin y) x))))
    double code(double x, double y, double z) {
    	double tmp;
    	if ((z <= -1.32e+98) || !(z <= 1.65e+176)) {
    		tmp = fma(cos(y), z, sin(y));
    	} else {
    		tmp = fma(1.0, z, (sin(y) + x));
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	tmp = 0.0
    	if ((z <= -1.32e+98) || !(z <= 1.65e+176))
    		tmp = fma(cos(y), z, sin(y));
    	else
    		tmp = fma(1.0, z, Float64(sin(y) + x));
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := If[Or[LessEqual[z, -1.32e+98], N[Not[LessEqual[z, 1.65e+176]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] * z + N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(1.0 * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq -1.32 \cdot 10^{+98} \lor \neg \left(z \leq 1.65 \cdot 10^{+176}\right):\\
    \;\;\;\;\mathsf{fma}\left(\cos y, z, \sin y\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(1, z, \sin y + x\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -1.3200000000000001e98 or 1.65000000000000012e176 < z

      1. Initial program 99.8%

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\cos y}, z, \sin y\right) \]
        5. lower-sin.f6491.0

          \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y}\right) \]
      5. Applied rewrites91.0%

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

      if -1.3200000000000001e98 < z < 1.65000000000000012e176

      1. Initial program 100.0%

        \[\left(x + \sin y\right) + z \cdot \cos y \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-+.f64N/A

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

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

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

          \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
        5. lower-fma.f64100.0

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

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

          \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
        8. lower-+.f64100.0

          \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
      4. Applied rewrites100.0%

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{1}, z, \sin y + x\right) \]
      6. Step-by-step derivation
        1. Applied rewrites92.9%

          \[\leadsto \mathsf{fma}\left(\color{blue}{1}, z, \sin y + x\right) \]
      7. Recombined 2 regimes into one program.
      8. Final simplification92.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.32 \cdot 10^{+98} \lor \neg \left(z \leq 1.65 \cdot 10^{+176}\right):\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, \sin y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1, z, \sin y + x\right)\\ \end{array} \]
      9. Add Preprocessing

      Alternative 5: 99.9% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(\cos y, z, \sin y + x\right) \end{array} \]
      (FPCore (x y z) :precision binary64 (fma (cos y) z (+ (sin y) x)))
      double code(double x, double y, double z) {
      	return fma(cos(y), z, (sin(y) + x));
      }
      
      function code(x, y, z)
      	return fma(cos(y), z, Float64(sin(y) + x))
      end
      
      code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(\cos y, z, \sin y + x\right)
      \end{array}
      
      Derivation
      1. Initial program 99.9%

        \[\left(x + \sin y\right) + z \cdot \cos y \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-+.f64N/A

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

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

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

          \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
        5. lower-fma.f6499.9

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

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

          \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
        8. lower-+.f6499.9

          \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
      4. Applied rewrites99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, z, \sin y + x\right)} \]
      5. Add Preprocessing

      Alternative 6: 89.6% accurate, 1.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+98} \lor \neg \left(z \leq 9.5 \cdot 10^{+175}\right):\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1, z, \sin y + x\right)\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (or (<= z -1.15e+98) (not (<= z 9.5e+175)))
         (fma (cos y) z (+ x y))
         (fma 1.0 z (+ (sin y) x))))
      double code(double x, double y, double z) {
      	double tmp;
      	if ((z <= -1.15e+98) || !(z <= 9.5e+175)) {
      		tmp = fma(cos(y), z, (x + y));
      	} else {
      		tmp = fma(1.0, z, (sin(y) + x));
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	tmp = 0.0
      	if ((z <= -1.15e+98) || !(z <= 9.5e+175))
      		tmp = fma(cos(y), z, Float64(x + y));
      	else
      		tmp = fma(1.0, z, Float64(sin(y) + x));
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := If[Or[LessEqual[z, -1.15e+98], N[Not[LessEqual[z, 9.5e+175]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(1.0 * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;z \leq -1.15 \cdot 10^{+98} \lor \neg \left(z \leq 9.5 \cdot 10^{+175}\right):\\
      \;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(1, z, \sin y + x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < -1.15000000000000007e98 or 9.5000000000000006e175 < z

        1. Initial program 99.8%

          \[\left(x + \sin y\right) + z \cdot \cos y \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-+.f64N/A

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

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

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

            \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
          5. lower-fma.f6499.8

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

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

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
          8. lower-+.f6499.8

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
        4. Applied rewrites99.8%

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

          \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + y}\right) \]
        6. Step-by-step derivation
          1. lower-+.f6487.2

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + y}\right) \]
        7. Applied rewrites87.2%

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

        if -1.15000000000000007e98 < z < 9.5000000000000006e175

        1. Initial program 100.0%

          \[\left(x + \sin y\right) + z \cdot \cos y \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-+.f64N/A

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

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

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

            \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
          5. lower-fma.f64100.0

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

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

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
          8. lower-+.f64100.0

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
        4. Applied rewrites100.0%

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{1}, z, \sin y + x\right) \]
        6. Step-by-step derivation
          1. Applied rewrites92.9%

            \[\leadsto \mathsf{fma}\left(\color{blue}{1}, z, \sin y + x\right) \]
        7. Recombined 2 regimes into one program.
        8. Final simplification91.2%

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+98} \lor \neg \left(z \leq 9.5 \cdot 10^{+175}\right):\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1, z, \sin y + x\right)\\ \end{array} \]
        9. Add Preprocessing

        Alternative 7: 89.6% accurate, 1.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+98}:\\ \;\;\;\;\left(y + x\right) + z \cdot \cos y\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+175}:\\ \;\;\;\;\mathsf{fma}\left(1, z, \sin y + x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= z -1.15e+98)
           (+ (+ y x) (* z (cos y)))
           (if (<= z 9.5e+175) (fma 1.0 z (+ (sin y) x)) (fma (cos y) z (+ x y)))))
        double code(double x, double y, double z) {
        	double tmp;
        	if (z <= -1.15e+98) {
        		tmp = (y + x) + (z * cos(y));
        	} else if (z <= 9.5e+175) {
        		tmp = fma(1.0, z, (sin(y) + x));
        	} else {
        		tmp = fma(cos(y), z, (x + y));
        	}
        	return tmp;
        }
        
        function code(x, y, z)
        	tmp = 0.0
        	if (z <= -1.15e+98)
        		tmp = Float64(Float64(y + x) + Float64(z * cos(y)));
        	elseif (z <= 9.5e+175)
        		tmp = fma(1.0, z, Float64(sin(y) + x));
        	else
        		tmp = fma(cos(y), z, Float64(x + y));
        	end
        	return tmp
        end
        
        code[x_, y_, z_] := If[LessEqual[z, -1.15e+98], N[(N[(y + x), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.5e+175], N[(1.0 * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -1.15 \cdot 10^{+98}:\\
        \;\;\;\;\left(y + x\right) + z \cdot \cos y\\
        
        \mathbf{elif}\;z \leq 9.5 \cdot 10^{+175}:\\
        \;\;\;\;\mathsf{fma}\left(1, z, \sin y + x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if z < -1.15000000000000007e98

          1. Initial program 99.9%

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

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

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

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

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

          if -1.15000000000000007e98 < z < 9.5000000000000006e175

          1. Initial program 100.0%

            \[\left(x + \sin y\right) + z \cdot \cos y \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-+.f64N/A

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

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

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

              \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
            5. lower-fma.f64100.0

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

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

              \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
            8. lower-+.f64100.0

              \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
          4. Applied rewrites100.0%

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{1}, z, \sin y + x\right) \]
          6. Step-by-step derivation
            1. Applied rewrites92.9%

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

            if 9.5000000000000006e175 < z

            1. Initial program 99.7%

              \[\left(x + \sin y\right) + z \cdot \cos y \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-+.f64N/A

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

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

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

                \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
              5. lower-fma.f6499.7

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

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

                \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
              8. lower-+.f6499.7

                \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
            4. Applied rewrites99.7%

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

              \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + y}\right) \]
            6. Step-by-step derivation
              1. lower-+.f6493.5

                \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + y}\right) \]
            7. Applied rewrites93.5%

              \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{x + y}\right) \]
          7. Recombined 3 regimes into one program.
          8. Final simplification91.2%

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{+98}:\\ \;\;\;\;\left(y + x\right) + z \cdot \cos y\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+175}:\\ \;\;\;\;\mathsf{fma}\left(1, z, \sin y + x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\ \end{array} \]
          9. Add Preprocessing

          Alternative 8: 82.6% accurate, 1.9× speedup?

          \[\begin{array}{l} \\ \mathsf{fma}\left(1, z, \sin y + x\right) \end{array} \]
          (FPCore (x y z) :precision binary64 (fma 1.0 z (+ (sin y) x)))
          double code(double x, double y, double z) {
          	return fma(1.0, z, (sin(y) + x));
          }
          
          function code(x, y, z)
          	return fma(1.0, z, Float64(sin(y) + x))
          end
          
          code[x_, y_, z_] := N[(1.0 * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \mathsf{fma}\left(1, z, \sin y + x\right)
          \end{array}
          
          Derivation
          1. Initial program 99.9%

            \[\left(x + \sin y\right) + z \cdot \cos y \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-+.f64N/A

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

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

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

              \[\leadsto \color{blue}{\cos y \cdot z} + \left(x + \sin y\right) \]
            5. lower-fma.f6499.9

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

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

              \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
            8. lower-+.f6499.9

              \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y + x}\right) \]
          4. Applied rewrites99.9%

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{1}, z, \sin y + x\right) \]
            2. Add Preprocessing

            Alternative 9: 70.5% accurate, 5.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.7 \lor \neg \left(y \leq 29000\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (or (<= y -4.7) (not (<= y 29000.0)))
               (+ z x)
               (fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y (+ z x))))
            double code(double x, double y, double z) {
            	double tmp;
            	if ((y <= -4.7) || !(y <= 29000.0)) {
            		tmp = z + x;
            	} else {
            		tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, (z + x));
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if ((y <= -4.7) || !(y <= 29000.0))
            		tmp = Float64(z + x);
            	else
            		tmp = fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, Float64(z + x));
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[Or[LessEqual[y, -4.7], N[Not[LessEqual[y, 29000.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq -4.7 \lor \neg \left(y \leq 29000\right):\\
            \;\;\;\;z + x\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -4.70000000000000018 or 29000 < y

              1. Initial program 99.8%

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

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

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

                  \[\leadsto \color{blue}{z + x} \]
              5. Applied rewrites48.0%

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

              if -4.70000000000000018 < y < 29000

              1. Initial program 100.0%

                \[\left(x + \sin y\right) + z \cdot \cos y \]
              2. Add Preprocessing
              3. 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)} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, y, \frac{-1}{2} \cdot z\right), y, 1\right), y, \color{blue}{z + x}\right) \]
                14. lower-+.f6499.2

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, \color{blue}{z + x}\right) \]
              5. Applied rewrites99.2%

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.7 \lor \neg \left(y \leq 29000\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)\\ \end{array} \]
            5. Add Preprocessing

            Alternative 10: 70.4% accurate, 6.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -30 \lor \neg \left(y \leq 29000\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z \cdot y, -0.5, 1\right), y, z + x\right)\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (or (<= y -30.0) (not (<= y 29000.0)))
               (+ z x)
               (fma (fma (* z y) -0.5 1.0) y (+ z x))))
            double code(double x, double y, double z) {
            	double tmp;
            	if ((y <= -30.0) || !(y <= 29000.0)) {
            		tmp = z + x;
            	} else {
            		tmp = fma(fma((z * y), -0.5, 1.0), y, (z + x));
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if ((y <= -30.0) || !(y <= 29000.0))
            		tmp = Float64(z + x);
            	else
            		tmp = fma(fma(Float64(z * y), -0.5, 1.0), y, Float64(z + x));
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[Or[LessEqual[y, -30.0], N[Not[LessEqual[y, 29000.0]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq -30 \lor \neg \left(y \leq 29000\right):\\
            \;\;\;\;z + x\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z \cdot y, -0.5, 1\right), y, z + x\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -30 or 29000 < y

              1. Initial program 99.8%

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

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

                  \[\leadsto \color{blue}{z + x} \]
                2. lower-+.f6448.3

                  \[\leadsto \color{blue}{z + x} \]
              5. Applied rewrites48.3%

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

              if -30 < y < 29000

              1. Initial program 100.0%

                \[\left(x + \sin y\right) + z \cdot \cos y \]
              2. Add Preprocessing
              3. 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)} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -30 \lor \neg \left(y \leq 29000\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z \cdot y, -0.5, 1\right), y, z + x\right)\\ \end{array} \]
            5. Add Preprocessing

            Alternative 11: 70.1% accurate, 6.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+26} \lor \neg \left(y \leq 1.2 \cdot 10^{+26}\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right), y, z + x\right)\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (or (<= y -1.4e+26) (not (<= y 1.2e+26)))
               (+ z x)
               (fma (fma (* -0.16666666666666666 y) y 1.0) y (+ z x))))
            double code(double x, double y, double z) {
            	double tmp;
            	if ((y <= -1.4e+26) || !(y <= 1.2e+26)) {
            		tmp = z + x;
            	} else {
            		tmp = fma(fma((-0.16666666666666666 * y), y, 1.0), y, (z + x));
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if ((y <= -1.4e+26) || !(y <= 1.2e+26))
            		tmp = Float64(z + x);
            	else
            		tmp = fma(fma(Float64(-0.16666666666666666 * y), y, 1.0), y, Float64(z + x));
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[Or[LessEqual[y, -1.4e+26], N[Not[LessEqual[y, 1.2e+26]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(-0.16666666666666666 * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq -1.4 \cdot 10^{+26} \lor \neg \left(y \leq 1.2 \cdot 10^{+26}\right):\\
            \;\;\;\;z + x\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right), y, z + x\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -1.4e26 or 1.20000000000000002e26 < y

              1. Initial program 99.8%

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

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

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

                  \[\leadsto \color{blue}{z + x} \]
              5. Applied rewrites48.7%

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

              if -1.4e26 < y < 1.20000000000000002e26

              1. Initial program 100.0%

                \[\left(x + \sin y\right) + z \cdot \cos y \]
              2. Add Preprocessing
              3. 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)} \]
              4. Step-by-step derivation
                1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, y, \frac{-1}{2} \cdot z\right), y, 1\right), y, \color{blue}{z + x}\right) \]
                14. lower-+.f6490.4

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

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

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6} \cdot y, y, 1\right), y, z + x\right) \]
              7. Step-by-step derivation
                1. Applied rewrites90.9%

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right), y, z + x\right) \]
              8. Recombined 2 regimes into one program.
              9. Final simplification71.6%

                \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+26} \lor \neg \left(y \leq 1.2 \cdot 10^{+26}\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right), y, z + x\right)\\ \end{array} \]
              10. Add Preprocessing

              Alternative 12: 67.8% accurate, 13.2× speedup?

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

                1. Initial program 99.9%

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

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

                    \[\leadsto \color{blue}{z + x} \]
                  2. lower-+.f6479.6

                    \[\leadsto \color{blue}{z + x} \]
                5. Applied rewrites79.6%

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

                if -1.44999999999999995e-58 < x < 3.1000000000000001e-144

                1. Initial program 99.9%

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\cos y}, z, \sin y\right) \]
                  5. lower-sin.f6498.5

                    \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y}\right) \]
                5. Applied rewrites98.5%

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

                  \[\leadsto y + \color{blue}{z} \]
                7. Step-by-step derivation
                  1. Applied rewrites50.2%

                    \[\leadsto z + \color{blue}{y} \]
                8. Recombined 2 regimes into one program.
                9. Final simplification70.3%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{-58} \lor \neg \left(x \leq 3.1 \cdot 10^{-144}\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;z + y\\ \end{array} \]
                10. Add Preprocessing

                Alternative 13: 29.2% accurate, 53.0× speedup?

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\cos y}, z, \sin y\right) \]
                  5. lower-sin.f6457.7

                    \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y}\right) \]
                5. Applied rewrites57.7%

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

                  \[\leadsto y + \color{blue}{z} \]
                7. Step-by-step derivation
                  1. Applied rewrites30.4%

                    \[\leadsto z + \color{blue}{y} \]
                  2. Add Preprocessing

                  Reproduce

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