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

Percentage Accurate: 99.9% → 99.9%
Time: 7.9s
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: 80.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x + \sin y\right) + z \cdot \cos y\\ \mathbf{if}\;t\_0 \leq -200:\\ \;\;\;\;z + x\\ \mathbf{elif}\;t\_0 \leq -0.05:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;t\_0 \leq 10^{-45}:\\ \;\;\;\;\left(x + y\right) + z\\ \mathbf{elif}\;t\_0 \leq 1:\\ \;\;\;\;\sin y\\ \mathbf{else}:\\ \;\;\;\;z + x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ (+ x (sin y)) (* z (cos y)))))
   (if (<= t_0 -200.0)
     (+ z x)
     (if (<= t_0 -0.05)
       (sin y)
       (if (<= t_0 1e-45) (+ (+ x y) z) (if (<= t_0 1.0) (sin y) (+ z x)))))))
double code(double x, double y, double z) {
	double t_0 = (x + sin(y)) + (z * cos(y));
	double tmp;
	if (t_0 <= -200.0) {
		tmp = z + x;
	} else if (t_0 <= -0.05) {
		tmp = sin(y);
	} else if (t_0 <= 1e-45) {
		tmp = (x + y) + z;
	} else if (t_0 <= 1.0) {
		tmp = sin(y);
	} else {
		tmp = z + x;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x + sin(y)) + (z * cos(y))
    if (t_0 <= (-200.0d0)) then
        tmp = z + x
    else if (t_0 <= (-0.05d0)) then
        tmp = sin(y)
    else if (t_0 <= 1d-45) then
        tmp = (x + y) + z
    else if (t_0 <= 1.0d0) then
        tmp = sin(y)
    else
        tmp = z + x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x + Math.sin(y)) + (z * Math.cos(y));
	double tmp;
	if (t_0 <= -200.0) {
		tmp = z + x;
	} else if (t_0 <= -0.05) {
		tmp = Math.sin(y);
	} else if (t_0 <= 1e-45) {
		tmp = (x + y) + z;
	} else if (t_0 <= 1.0) {
		tmp = Math.sin(y);
	} else {
		tmp = z + x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + math.sin(y)) + (z * math.cos(y))
	tmp = 0
	if t_0 <= -200.0:
		tmp = z + x
	elif t_0 <= -0.05:
		tmp = math.sin(y)
	elif t_0 <= 1e-45:
		tmp = (x + y) + z
	elif t_0 <= 1.0:
		tmp = math.sin(y)
	else:
		tmp = z + x
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
	tmp = 0.0
	if (t_0 <= -200.0)
		tmp = Float64(z + x);
	elseif (t_0 <= -0.05)
		tmp = sin(y);
	elseif (t_0 <= 1e-45)
		tmp = Float64(Float64(x + y) + z);
	elseif (t_0 <= 1.0)
		tmp = sin(y);
	else
		tmp = Float64(z + x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x + sin(y)) + (z * cos(y));
	tmp = 0.0;
	if (t_0 <= -200.0)
		tmp = z + x;
	elseif (t_0 <= -0.05)
		tmp = sin(y);
	elseif (t_0 <= 1e-45)
		tmp = (x + y) + z;
	elseif (t_0 <= 1.0)
		tmp = sin(y);
	else
		tmp = z + x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -200.0], N[(z + x), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[Sin[y], $MachinePrecision], If[LessEqual[t$95$0, 1e-45], N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[y], $MachinePrecision], N[(z + x), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin y\\

\mathbf{else}:\\
\;\;\;\;z + x\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -200 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-+.f6478.2

        \[\leadsto \color{blue}{z + x} \]
    5. Applied rewrites78.2%

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

    if -200 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.050000000000000003 or 9.99999999999999984e-46 < (+.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.f6494.9

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

      \[\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 rewrites4.1%

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

        \[\leadsto \sin y \]
      3. Step-by-step derivation
        1. Applied rewrites92.1%

          \[\leadsto \sin y \]

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

        1. Initial program 100.0%

          \[\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.f6466.9

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

          \[\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 rewrites66.9%

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

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

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

              \[\leadsto \color{blue}{\left(x + y\right) + z} \]
            3. lower-+.f64100.0

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

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

        Alternative 3: 99.9% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ \mathsf{fma}\left(\cos y, z, \sin y\right) + x \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 Float64(fma(cos(y), z, sin(y)) + x)
        end
        
        code[x_, y_, z_] := N[(N[(N[Cos[y], $MachinePrecision] * z + N[Sin[y], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \mathsf{fma}\left(\cos y, z, \sin y\right) + x
        \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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

        Alternative 4: 89.9% accurate, 1.7× speedup?

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

          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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\cos y \cdot z} \]
            3. lower-cos.f6489.1

              \[\leadsto \color{blue}{\cos y} \cdot z \]
          7. Applied rewrites89.1%

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

          if -8.5e146 < z < 3.7999999999999998e91

          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 \left(x + \sin y\right) + z \cdot \color{blue}{1} \]
          4. Step-by-step derivation
            1. Applied rewrites95.7%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.5 \cdot 10^{+146} \lor \neg \left(z \leq 3.8 \cdot 10^{+91}\right):\\ \;\;\;\;\cos y \cdot z\\ \mathbf{else}:\\ \;\;\;\;\left(x + \sin y\right) + z \cdot 1\\ \end{array} \]
          7. Add Preprocessing

          Alternative 5: 84.8% accurate, 1.7× speedup?

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

            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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\cos y \cdot z} \]
              3. lower-cos.f6485.9

                \[\leadsto \color{blue}{\cos y} \cdot z \]
            7. Applied rewrites85.9%

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

            if -8.5e146 < z < -5.8e-18

            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 + z} \]
            4. Step-by-step derivation
              1. +-commutativeN/A

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

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

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

            if -5.8e-18 < z < 5.9000000000000002e22

            1. Initial program 100.0%

              \[\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.f6438.4

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

              \[\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 rewrites16.4%

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

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

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

                  \[\leadsto 1 \cdot \color{blue}{\left(\sin y + x\right)} \]
                3. distribute-lft-inN/A

                  \[\leadsto \color{blue}{1 \cdot \sin y + 1 \cdot x} \]
                4. *-lft-identityN/A

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

                  \[\leadsto \color{blue}{\sin y \cdot 1} + x \]
                6. rgt-mult-inverseN/A

                  \[\leadsto \sin y \cdot \color{blue}{\left(z \cdot \frac{1}{z}\right)} + x \]
                7. associate-*r/N/A

                  \[\leadsto \sin y \cdot \color{blue}{\frac{z \cdot 1}{z}} + x \]
                8. *-rgt-identityN/A

                  \[\leadsto \sin y \cdot \frac{\color{blue}{z}}{z} + x \]
                9. associate-/l*N/A

                  \[\leadsto \color{blue}{\frac{\sin y \cdot z}{z}} + x \]
                10. associate-*l/N/A

                  \[\leadsto \color{blue}{\frac{\sin y}{z} \cdot z} + x \]
                11. *-commutativeN/A

                  \[\leadsto \color{blue}{z \cdot \frac{\sin y}{z}} + x \]
                12. remove-double-negN/A

                  \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{\sin y}{z}\right)\right)\right)\right)} + x \]
                13. mul-1-negN/A

                  \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \frac{\sin y}{z}}\right)\right) + x \]
                14. distribute-rgt-neg-inN/A

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

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

                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(-1 \cdot \frac{\sin y}{z}\right) + x} \]
              4. Applied rewrites95.6%

                \[\leadsto \color{blue}{\sin y + x} \]
            8. Recombined 3 regimes into one program.
            9. Final simplification90.3%

              \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.5 \cdot 10^{+146}:\\ \;\;\;\;\cos y \cdot z\\ \mathbf{elif}\;z \leq -5.8 \cdot 10^{-18}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;z \leq 5.9 \cdot 10^{+22}:\\ \;\;\;\;\sin y + x\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot z\\ \end{array} \]
            10. Add Preprocessing

            Alternative 6: 89.9% accurate, 1.7× speedup?

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

              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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\cos y \cdot z} \]
                3. lower-cos.f6489.1

                  \[\leadsto \color{blue}{\cos y} \cdot z \]
              7. Applied rewrites89.1%

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

              if -8.5e146 < z < 3.7999999999999998e91

              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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 7: 81.4% accurate, 1.8× speedup?

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

                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.f6461.7

                    \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y}\right) \]
                5. Applied rewrites61.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 rewrites5.1%

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

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

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

                      \[\leadsto 1 \cdot \color{blue}{\left(\sin y + x\right)} \]
                    3. distribute-lft-inN/A

                      \[\leadsto \color{blue}{1 \cdot \sin y + 1 \cdot x} \]
                    4. *-lft-identityN/A

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

                      \[\leadsto \color{blue}{\sin y \cdot 1} + x \]
                    6. rgt-mult-inverseN/A

                      \[\leadsto \sin y \cdot \color{blue}{\left(z \cdot \frac{1}{z}\right)} + x \]
                    7. associate-*r/N/A

                      \[\leadsto \sin y \cdot \color{blue}{\frac{z \cdot 1}{z}} + x \]
                    8. *-rgt-identityN/A

                      \[\leadsto \sin y \cdot \frac{\color{blue}{z}}{z} + x \]
                    9. associate-/l*N/A

                      \[\leadsto \color{blue}{\frac{\sin y \cdot z}{z}} + x \]
                    10. associate-*l/N/A

                      \[\leadsto \color{blue}{\frac{\sin y}{z} \cdot z} + x \]
                    11. *-commutativeN/A

                      \[\leadsto \color{blue}{z \cdot \frac{\sin y}{z}} + x \]
                    12. remove-double-negN/A

                      \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\frac{\sin y}{z}\right)\right)\right)\right)} + x \]
                    13. mul-1-negN/A

                      \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{-1 \cdot \frac{\sin y}{z}}\right)\right) + x \]
                    14. distribute-rgt-neg-inN/A

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

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

                      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z\right)\right) \cdot \left(-1 \cdot \frac{\sin y}{z}\right) + x} \]
                  4. Applied rewrites63.1%

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

                  if -0.160000000000000003 < y < 5.10000000000000017e-9

                  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. fp-cancel-sign-sub-invN/A

                      \[\leadsto \mathsf{fma}\left(\color{blue}{1 - \left(\mathsf{neg}\left(y\right)\right) \cdot \left(\frac{-1}{2} \cdot z + \frac{-1}{6} \cdot y\right)}, y, x + z\right) \]
                    8. fp-cancel-sub-sign-invN/A

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

                      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) \cdot \left(\frac{-1}{2} \cdot z + \frac{-1}{6} \cdot y\right) + 1}, y, x + z\right) \]
                    10. remove-double-negN/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) \]
                    11. *-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) \]
                    12. 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) \]
                    13. +-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) \]
                    14. 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) \]
                    15. 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) \]
                    16. +-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) \]
                    17. lower-+.f6499.7

                      \[\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.7%

                    \[\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. Step-by-step derivation
                    1. Applied rewrites99.7%

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

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

                  Alternative 8: 70.3% accurate, 5.4× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -10500000 \lor \neg \left(y \leq 7.2 \cdot 10^{-23}\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, x\right) + z\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (or (<= y -10500000.0) (not (<= y 7.2e-23)))
                     (+ z x)
                     (+ (fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y x) z)))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if ((y <= -10500000.0) || !(y <= 7.2e-23)) {
                  		tmp = z + x;
                  	} else {
                  		tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, x) + z;
                  	}
                  	return tmp;
                  }
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if ((y <= -10500000.0) || !(y <= 7.2e-23))
                  		tmp = Float64(z + x);
                  	else
                  		tmp = Float64(fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, x) + z);
                  	end
                  	return tmp
                  end
                  
                  code[x_, y_, z_] := If[Or[LessEqual[y, -10500000.0], N[Not[LessEqual[y, 7.2e-23]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + x), $MachinePrecision] + z), $MachinePrecision]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;y \leq -10500000 \lor \neg \left(y \leq 7.2 \cdot 10^{-23}\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, x\right) + z\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if y < -1.05e7 or 7.1999999999999996e-23 < 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-+.f6442.8

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

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

                    if -1.05e7 < y < 7.1999999999999996e-23

                    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. fp-cancel-sign-sub-invN/A

                        \[\leadsto \mathsf{fma}\left(\color{blue}{1 - \left(\mathsf{neg}\left(y\right)\right) \cdot \left(\frac{-1}{2} \cdot z + \frac{-1}{6} \cdot y\right)}, y, x + z\right) \]
                      8. fp-cancel-sub-sign-invN/A

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

                        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) \cdot \left(\frac{-1}{2} \cdot z + \frac{-1}{6} \cdot y\right) + 1}, y, x + z\right) \]
                      10. remove-double-negN/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) \]
                      11. *-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) \]
                      12. 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) \]
                      13. +-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) \]
                      14. 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) \]
                      15. 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) \]
                      16. +-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) \]
                      17. lower-+.f6499.3

                        \[\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.3%

                      \[\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. Step-by-step derivation
                      1. Applied rewrites99.3%

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -10500000 \lor \neg \left(y \leq 7.2 \cdot 10^{-23}\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, x\right) + z\\ \end{array} \]
                    9. Add Preprocessing

                    Alternative 9: 70.1% accurate, 6.4× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.65 \cdot 10^{+33} \lor \neg \left(y \leq 7.2 \cdot 10^{-23}\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 -1.65e+33) (not (<= y 7.2e-23)))
                       (+ 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 <= -1.65e+33) || !(y <= 7.2e-23)) {
                    		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 <= -1.65e+33) || !(y <= 7.2e-23))
                    		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, -1.65e+33], N[Not[LessEqual[y, 7.2e-23]], $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 -1.65 \cdot 10^{+33} \lor \neg \left(y \leq 7.2 \cdot 10^{-23}\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 < -1.64999999999999988e33 or 7.1999999999999996e-23 < 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-+.f6443.1

                          \[\leadsto \color{blue}{z + x} \]
                      5. Applied rewrites43.1%

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

                      if -1.64999999999999988e33 < y < 7.1999999999999996e-23

                      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.5

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.65 \cdot 10^{+33} \lor \neg \left(y \leq 7.2 \cdot 10^{-23}\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 10: 70.2% accurate, 6.4× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -370 \lor \neg \left(y \leq 7.2 \cdot 10^{-23}\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 -370.0) (not (<= y 7.2e-23)))
                       (+ 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 <= -370.0) || !(y <= 7.2e-23)) {
                    		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 <= -370.0) || !(y <= 7.2e-23))
                    		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, -370.0], N[Not[LessEqual[y, 7.2e-23]], $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 -370 \lor \neg \left(y \leq 7.2 \cdot 10^{-23}\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 < -370 or 7.1999999999999996e-23 < 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-+.f6442.8

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

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

                      if -370 < y < 7.1999999999999996e-23

                      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. fp-cancel-sign-sub-invN/A

                          \[\leadsto \mathsf{fma}\left(\color{blue}{1 - \left(\mathsf{neg}\left(y\right)\right) \cdot \left(\frac{-1}{2} \cdot z + \frac{-1}{6} \cdot y\right)}, y, x + z\right) \]
                        8. fp-cancel-sub-sign-invN/A

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

                          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right) \cdot \left(\frac{-1}{2} \cdot z + \frac{-1}{6} \cdot y\right) + 1}, y, x + z\right) \]
                        10. remove-double-negN/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) \]
                        11. *-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) \]
                        12. 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) \]
                        13. +-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) \]
                        14. 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) \]
                        15. 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) \]
                        16. +-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) \]
                        17. lower-+.f6499.3

                          \[\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.3%

                        \[\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 rewrites99.0%

                          \[\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.8%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -370 \lor \neg \left(y \leq 7.2 \cdot 10^{-23}\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 11: 70.2% accurate, 11.1× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{+47} \lor \neg \left(y \leq 2.5 \cdot 10^{+83}\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\left(x + y\right) + z\\ \end{array} \end{array} \]
                      (FPCore (x y z)
                       :precision binary64
                       (if (or (<= y -8.5e+47) (not (<= y 2.5e+83))) (+ z x) (+ (+ x y) z)))
                      double code(double x, double y, double z) {
                      	double tmp;
                      	if ((y <= -8.5e+47) || !(y <= 2.5e+83)) {
                      		tmp = z + x;
                      	} else {
                      		tmp = (x + y) + 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 <= (-8.5d+47)) .or. (.not. (y <= 2.5d+83))) then
                              tmp = z + x
                          else
                              tmp = (x + y) + z
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double x, double y, double z) {
                      	double tmp;
                      	if ((y <= -8.5e+47) || !(y <= 2.5e+83)) {
                      		tmp = z + x;
                      	} else {
                      		tmp = (x + y) + z;
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y, z):
                      	tmp = 0
                      	if (y <= -8.5e+47) or not (y <= 2.5e+83):
                      		tmp = z + x
                      	else:
                      		tmp = (x + y) + z
                      	return tmp
                      
                      function code(x, y, z)
                      	tmp = 0.0
                      	if ((y <= -8.5e+47) || !(y <= 2.5e+83))
                      		tmp = Float64(z + x);
                      	else
                      		tmp = Float64(Float64(x + y) + z);
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(x, y, z)
                      	tmp = 0.0;
                      	if ((y <= -8.5e+47) || ~((y <= 2.5e+83)))
                      		tmp = z + x;
                      	else
                      		tmp = (x + y) + z;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[x_, y_, z_] := If[Or[LessEqual[y, -8.5e+47], N[Not[LessEqual[y, 2.5e+83]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;y \leq -8.5 \cdot 10^{+47} \lor \neg \left(y \leq 2.5 \cdot 10^{+83}\right):\\
                      \;\;\;\;z + x\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(x + y\right) + z\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if y < -8.5000000000000008e47 or 2.50000000000000014e83 < 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-+.f6441.2

                            \[\leadsto \color{blue}{z + x} \]
                        5. Applied rewrites41.2%

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

                        if -8.5000000000000008e47 < y < 2.50000000000000014e83

                        1. Initial program 100.0%

                          \[\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.f6451.9

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

                          \[\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 rewrites45.0%

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

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

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

                              \[\leadsto \color{blue}{\left(x + y\right) + z} \]
                            3. lower-+.f6493.0

                              \[\leadsto \color{blue}{\left(x + y\right)} + z \]
                          4. Applied rewrites93.0%

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

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

                        Alternative 12: 68.5% accurate, 13.2× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.25 \cdot 10^{-150} \lor \neg \left(x \leq 1.5 \cdot 10^{-146}\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;z + y\\ \end{array} \end{array} \]
                        (FPCore (x y z)
                         :precision binary64
                         (if (or (<= x -2.25e-150) (not (<= x 1.5e-146))) (+ z x) (+ z y)))
                        double code(double x, double y, double z) {
                        	double tmp;
                        	if ((x <= -2.25e-150) || !(x <= 1.5e-146)) {
                        		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 <= (-2.25d-150)) .or. (.not. (x <= 1.5d-146))) 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 <= -2.25e-150) || !(x <= 1.5e-146)) {
                        		tmp = z + x;
                        	} else {
                        		tmp = z + y;
                        	}
                        	return tmp;
                        }
                        
                        def code(x, y, z):
                        	tmp = 0
                        	if (x <= -2.25e-150) or not (x <= 1.5e-146):
                        		tmp = z + x
                        	else:
                        		tmp = z + y
                        	return tmp
                        
                        function code(x, y, z)
                        	tmp = 0.0
                        	if ((x <= -2.25e-150) || !(x <= 1.5e-146))
                        		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 <= -2.25e-150) || ~((x <= 1.5e-146)))
                        		tmp = z + x;
                        	else
                        		tmp = z + y;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        code[x_, y_, z_] := If[Or[LessEqual[x, -2.25e-150], N[Not[LessEqual[x, 1.5e-146]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(z + y), $MachinePrecision]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;x \leq -2.25 \cdot 10^{-150} \lor \neg \left(x \leq 1.5 \cdot 10^{-146}\right):\\
                        \;\;\;\;z + x\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;z + y\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if x < -2.2500000000000001e-150 or 1.50000000000000009e-146 < 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.0

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

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

                          if -2.2500000000000001e-150 < x < 1.50000000000000009e-146

                          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.8

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

                            \[\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 rewrites46.1%

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

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

                          Alternative 13: 30.5% 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.f6456.1

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

                            \[\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 rewrites28.4%

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

                            Reproduce

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