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

Percentage Accurate: 99.9% → 99.9%
Time: 4.4s
Alternatives: 11
Speedup: 1.0×

Specification

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

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

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

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 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} \\ \mathsf{fma}\left(\cos y, z, \sin y + x\right) \end{array} \]
(FPCore (x y z) :precision binary64 (fma (cos y) z (+ (sin y) x)))
double code(double x, double y, double z) {
	return fma(cos(y), z, (sin(y) + x));
}
function code(x, y, z)
	return fma(cos(y), z, Float64(sin(y) + x))
end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] * z + N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 88.9% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -6.4 \cdot 10^{+188}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 2.8 \cdot 10^{+32}:\\
\;\;\;\;\left(x + \sin y\right) + z\\

\mathbf{elif}\;z \leq 2.2 \cdot 10^{+108}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos y, z, x\right) + y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.39999999999999941e188 or 2.8e32 < z < 2.2000000000000001e108

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, \frac{z}{x + \sin y}, 1\right)} \cdot \left(x + \sin y\right) \]
      9. lower-/.f6496.0

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

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

        \[\leadsto \mathsf{fma}\left(\cos y, \frac{z}{\color{blue}{\sin y + x}}, 1\right) \cdot \left(x + \sin y\right) \]
      12. lower-+.f6496.0

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

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

        \[\leadsto \mathsf{fma}\left(\cos y, \frac{z}{\sin y + x}, 1\right) \cdot \color{blue}{\left(\sin y + x\right)} \]
      15. lower-+.f6496.0

        \[\leadsto \mathsf{fma}\left(\cos y, \frac{z}{\sin y + x}, 1\right) \cdot \color{blue}{\left(\sin y + x\right)} \]
    3. Applied rewrites96.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\cos y, \frac{1}{\frac{\color{blue}{\sin y + x}}{z}}, 1\right) \cdot \left(\sin y + x\right) \]
      10. lift-+.f6495.9

        \[\leadsto \mathsf{fma}\left(\cos y, \frac{1}{\frac{\color{blue}{\sin y + x}}{z}}, 1\right) \cdot \left(\sin y + x\right) \]
    5. Applied rewrites95.9%

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

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

        \[\leadsto z \cdot \color{blue}{\cos y} \]
      2. lower-cos.f6442.6

        \[\leadsto z \cdot \cos y \]
    8. Applied rewrites42.6%

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

    if -6.39999999999999941e188 < z < 2.8e32

    1. Initial program 99.9%

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

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

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

      if 2.2000000000000001e108 < z

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 88.7% accurate, 0.9× speedup?

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

        1. Initial program 99.9%

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

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

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

          if -4.40000000000000019e-209 < x < 2.2e8

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\cos y, z, \color{blue}{\sin y}\right) \]
          5. Step-by-step derivation
            1. lower-sin.f6458.8

              \[\leadsto \mathsf{fma}\left(\cos y, z, \sin y\right) \]
          6. Applied rewrites58.8%

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

          if 2.2e8 < x

          1. Initial program 99.9%

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

            \[\leadsto \color{blue}{x + z} \]
          3. Step-by-step derivation
            1. lower-+.f6466.3

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(\left(x + z\right) \cdot \left(x - z\right)\right) \cdot \frac{1}{\color{blue}{x - z}} \]
            10. lower--.f6434.6

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

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

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

              \[\leadsto \left(\left(x + z\right) \cdot \left(x - z\right)\right) \cdot \frac{1}{\color{blue}{x - z}} \]
            3. mult-flip-revN/A

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

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

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

              \[\leadsto \frac{\left(x + z\right) \cdot \left(x - z\right)}{x - z} \]
            7. difference-of-squares-revN/A

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

              \[\leadsto \frac{x \cdot x - z \cdot z}{x - \color{blue}{z}} \]
            9. difference-of-squares-revN/A

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

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

              \[\leadsto \frac{\left(x + z\right) \cdot \left(x - z\right)}{x - z} \]
            12. *-commutativeN/A

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

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

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

              \[\leadsto \left(x - z\right) \cdot \color{blue}{\frac{x + z}{x - z}} \]
            16. lower-/.f6466.3

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

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

        Alternative 4: 87.0% accurate, 1.6× speedup?

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

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, \frac{z}{x + \sin y}, 1\right)} \cdot \left(x + \sin y\right) \]
            9. lower-/.f6496.0

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

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

              \[\leadsto \mathsf{fma}\left(\cos y, \frac{z}{\color{blue}{\sin y + x}}, 1\right) \cdot \left(x + \sin y\right) \]
            12. lower-+.f6496.0

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

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

              \[\leadsto \mathsf{fma}\left(\cos y, \frac{z}{\sin y + x}, 1\right) \cdot \color{blue}{\left(\sin y + x\right)} \]
            15. lower-+.f6496.0

              \[\leadsto \mathsf{fma}\left(\cos y, \frac{z}{\sin y + x}, 1\right) \cdot \color{blue}{\left(\sin y + x\right)} \]
          3. Applied rewrites96.0%

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\cos y, \frac{1}{\frac{\color{blue}{\sin y + x}}{z}}, 1\right) \cdot \left(\sin y + x\right) \]
            10. lift-+.f6495.9

              \[\leadsto \mathsf{fma}\left(\cos y, \frac{1}{\frac{\color{blue}{\sin y + x}}{z}}, 1\right) \cdot \left(\sin y + x\right) \]
          5. Applied rewrites95.9%

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

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

              \[\leadsto z \cdot \color{blue}{\cos y} \]
            2. lower-cos.f6442.6

              \[\leadsto z \cdot \cos y \]
          8. Applied rewrites42.6%

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

          if -6.39999999999999941e188 < z < 2.8e32

          1. Initial program 99.9%

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

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

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

          Alternative 5: 81.3% accurate, 0.2× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 \cdot \sin y\\ t_1 := \left(x + \sin y\right) + z \cdot \cos y\\ \mathbf{if}\;t\_1 \leq -5:\\ \;\;\;\;x + z\\ \mathbf{elif}\;t\_1 \leq -0.2:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 0.001:\\ \;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \mathsf{fma}\left(-0.5, z, -0.16666666666666666 \cdot y\right)\right)\right)\\ \mathbf{elif}\;t\_1 \leq 1:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \frac{x + z}{x - z}\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (* 1.0 (sin y))) (t_1 (+ (+ x (sin y)) (* z (cos y)))))
             (if (<= t_1 -5.0)
               (+ x z)
               (if (<= t_1 -0.2)
                 t_0
                 (if (<= t_1 0.001)
                   (+
                    x
                    (+ z (* y (+ 1.0 (* y (fma -0.5 z (* -0.16666666666666666 y)))))))
                   (if (<= t_1 1.0) t_0 (* (- x z) (/ (+ x z) (- x z)))))))))
          double code(double x, double y, double z) {
          	double t_0 = 1.0 * sin(y);
          	double t_1 = (x + sin(y)) + (z * cos(y));
          	double tmp;
          	if (t_1 <= -5.0) {
          		tmp = x + z;
          	} else if (t_1 <= -0.2) {
          		tmp = t_0;
          	} else if (t_1 <= 0.001) {
          		tmp = x + (z + (y * (1.0 + (y * fma(-0.5, z, (-0.16666666666666666 * y))))));
          	} else if (t_1 <= 1.0) {
          		tmp = t_0;
          	} else {
          		tmp = (x - z) * ((x + z) / (x - z));
          	}
          	return tmp;
          }
          
          function code(x, y, z)
          	t_0 = Float64(1.0 * sin(y))
          	t_1 = Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
          	tmp = 0.0
          	if (t_1 <= -5.0)
          		tmp = Float64(x + z);
          	elseif (t_1 <= -0.2)
          		tmp = t_0;
          	elseif (t_1 <= 0.001)
          		tmp = Float64(x + Float64(z + Float64(y * Float64(1.0 + Float64(y * fma(-0.5, z, Float64(-0.16666666666666666 * y)))))));
          	elseif (t_1 <= 1.0)
          		tmp = t_0;
          	else
          		tmp = Float64(Float64(x - z) * Float64(Float64(x + z) / Float64(x - z)));
          	end
          	return tmp
          end
          
          code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5.0], N[(x + z), $MachinePrecision], If[LessEqual[t$95$1, -0.2], t$95$0, If[LessEqual[t$95$1, 0.001], N[(x + N[(z + N[(y * N[(1.0 + N[(y * N[(-0.5 * z + N[(-0.16666666666666666 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.0], t$95$0, N[(N[(x - z), $MachinePrecision] * N[(N[(x + z), $MachinePrecision] / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := 1 \cdot \sin y\\
          t_1 := \left(x + \sin y\right) + z \cdot \cos y\\
          \mathbf{if}\;t\_1 \leq -5:\\
          \;\;\;\;x + z\\
          
          \mathbf{elif}\;t\_1 \leq -0.2:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;t\_1 \leq 0.001:\\
          \;\;\;\;x + \left(z + y \cdot \left(1 + y \cdot \mathsf{fma}\left(-0.5, z, -0.16666666666666666 \cdot y\right)\right)\right)\\
          
          \mathbf{elif}\;t\_1 \leq 1:\\
          \;\;\;\;t\_0\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(x - z\right) \cdot \frac{x + z}{x - z}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 4 regimes
          2. if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -5

            1. Initial program 99.9%

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

              \[\leadsto \color{blue}{x + z} \]
            3. Step-by-step derivation
              1. lower-+.f6466.3

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

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

            if -5 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.20000000000000001 or 1e-3 < (+.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. Step-by-step derivation
              1. lift-+.f64N/A

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(\cos y, \frac{z}{x + \sin y}, 1\right)} \cdot \left(x + \sin y\right) \]
              9. lower-/.f6496.0

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

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

                \[\leadsto \mathsf{fma}\left(\cos y, \frac{z}{\color{blue}{\sin y + x}}, 1\right) \cdot \left(x + \sin y\right) \]
              12. lower-+.f6496.0

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

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

                \[\leadsto \mathsf{fma}\left(\cos y, \frac{z}{\sin y + x}, 1\right) \cdot \color{blue}{\left(\sin y + x\right)} \]
              15. lower-+.f6496.0

                \[\leadsto \mathsf{fma}\left(\cos y, \frac{z}{\sin y + x}, 1\right) \cdot \color{blue}{\left(\sin y + x\right)} \]
            3. Applied rewrites96.0%

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

              \[\leadsto \color{blue}{1} \cdot \left(\sin y + x\right) \]
            5. Step-by-step derivation
              1. Applied rewrites58.7%

                \[\leadsto \color{blue}{1} \cdot \left(\sin y + x\right) \]
              2. Taylor expanded in x around 0

                \[\leadsto 1 \cdot \color{blue}{\sin y} \]
              3. Step-by-step derivation
                1. lower-sin.f6418.5

                  \[\leadsto 1 \cdot \sin y \]
              4. Applied rewrites18.5%

                \[\leadsto 1 \cdot \color{blue}{\sin y} \]

              if -0.20000000000000001 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1e-3

              1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 99.9%

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

                \[\leadsto \color{blue}{x + z} \]
              3. Step-by-step derivation
                1. lower-+.f6466.3

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \left(\left(x + z\right) \cdot \left(x - z\right)\right) \cdot \frac{1}{\color{blue}{x - z}} \]
                10. lower--.f6434.6

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

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

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

                  \[\leadsto \left(\left(x + z\right) \cdot \left(x - z\right)\right) \cdot \frac{1}{\color{blue}{x - z}} \]
                3. mult-flip-revN/A

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

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

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

                  \[\leadsto \frac{\left(x + z\right) \cdot \left(x - z\right)}{x - z} \]
                7. difference-of-squares-revN/A

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

                  \[\leadsto \frac{x \cdot x - z \cdot z}{x - \color{blue}{z}} \]
                9. difference-of-squares-revN/A

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

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

                  \[\leadsto \frac{\left(x + z\right) \cdot \left(x - z\right)}{x - z} \]
                12. *-commutativeN/A

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

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

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

                  \[\leadsto \left(x - z\right) \cdot \color{blue}{\frac{x + z}{x - z}} \]
                16. lower-/.f6466.3

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

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

            Alternative 6: 70.6% accurate, 2.9× speedup?

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

              1. Initial program 99.9%

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

                \[\leadsto \color{blue}{x + z} \]
              3. Step-by-step derivation
                1. lower-+.f6466.3

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \left(\left(x + z\right) \cdot \left(x - z\right)\right) \cdot \frac{1}{\color{blue}{x - z}} \]
                10. lower--.f6434.6

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

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

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

                  \[\leadsto \left(\left(x + z\right) \cdot \left(x - z\right)\right) \cdot \frac{1}{\color{blue}{x - z}} \]
                3. mult-flip-revN/A

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

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

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

                  \[\leadsto \frac{\left(x + z\right) \cdot \left(x - z\right)}{x - z} \]
                7. difference-of-squares-revN/A

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

                  \[\leadsto \frac{x \cdot x - z \cdot z}{x - \color{blue}{z}} \]
                9. difference-of-squares-revN/A

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

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

                  \[\leadsto \frac{\left(x + z\right) \cdot \left(x - z\right)}{x - z} \]
                12. *-commutativeN/A

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

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

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

                  \[\leadsto \left(x - z\right) \cdot \color{blue}{\frac{x + z}{x - z}} \]
                16. lower-/.f6466.3

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

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

              if -7.7999999999999996e65 < y < 6.00000000000000033e55

              1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{x + \left(z + y \cdot \left(1 + y \cdot \mathsf{fma}\left(-0.5, z, -0.16666666666666666 \cdot y\right)\right)\right)} \]
              5. Step-by-step derivation
                1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.5, z, -0.16666666666666666 \cdot y\right), y, 1\right), \frac{y}{z}, 1\right), z, x\right) \]
              6. Applied rewrites53.9%

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

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{2} \cdot z, y, 1\right), \frac{y}{z}, 1\right), z, x\right) \]
              8. Step-by-step derivation
                1. lower-*.f6456.0

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot z, y, 1\right), \frac{y}{z}, 1\right), z, x\right) \]
              9. Applied rewrites56.0%

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot z, y, 1\right), \frac{y}{z}, 1\right), z, x\right) \]
              10. Step-by-step derivation
                1. lift-fma.f64N/A

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

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

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

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

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

                  \[\leadsto \left(1 + \frac{\mathsf{fma}\left(\frac{-1}{2} \cdot z, y, 1\right) \cdot y}{z}\right) \cdot z + x \]
                7. sum-to-mult-revN/A

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

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

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

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

            Alternative 7: 70.6% accurate, 3.2× speedup?

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

              1. Initial program 99.9%

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

                \[\leadsto \color{blue}{x + z} \]
              3. Step-by-step derivation
                1. lower-+.f6466.3

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \left(\left(x + z\right) \cdot \left(x - z\right)\right) \cdot \frac{1}{\color{blue}{x - z}} \]
                10. lower--.f6434.6

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

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

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

                  \[\leadsto \left(\left(x + z\right) \cdot \left(x - z\right)\right) \cdot \frac{1}{\color{blue}{x - z}} \]
                3. mult-flip-revN/A

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

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

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

                  \[\leadsto \frac{\left(x + z\right) \cdot \left(x - z\right)}{x - z} \]
                7. difference-of-squares-revN/A

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

                  \[\leadsto \frac{x \cdot x - z \cdot z}{x - \color{blue}{z}} \]
                9. difference-of-squares-revN/A

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

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

                  \[\leadsto \frac{\left(x + z\right) \cdot \left(x - z\right)}{x - z} \]
                12. *-commutativeN/A

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

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

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

                  \[\leadsto \left(x - z\right) \cdot \color{blue}{\frac{x + z}{x - z}} \]
                16. lower-/.f6466.3

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

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

              if -4.8999999999999999e73 < y < 9.4999999999999997e56

              1. Initial program 99.9%

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

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

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

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

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

            Alternative 8: 70.0% accurate, 5.2× speedup?

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

              1. Initial program 99.9%

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

                \[\leadsto \color{blue}{x + z} \]
              3. Step-by-step derivation
                1. lower-+.f6466.3

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

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

              if -4.8999999999999999e73 < y < 1.90000000000000002e40

              1. Initial program 99.9%

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

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

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

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

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

            Alternative 9: 68.2% accurate, 6.4× speedup?

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

              1. Initial program 99.9%

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

                \[\leadsto \color{blue}{x + z} \]
              3. Step-by-step derivation
                1. lower-+.f6466.3

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

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

              if -1.5499999999999999e-236 < x < 8.8000000000000005e-178

              1. Initial program 99.9%

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

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

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

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

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

                \[\leadsto y + \color{blue}{z} \]
              6. Step-by-step derivation
                1. lower-+.f6430.1

                  \[\leadsto y + z \]
              7. Applied rewrites30.1%

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

            Alternative 10: 30.1% accurate, 19.6× speedup?

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

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

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

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

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

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

              \[\leadsto y + \color{blue}{z} \]
            6. Step-by-step derivation
              1. lower-+.f6430.1

                \[\leadsto y + z \]
            7. Applied rewrites30.1%

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

            Alternative 11: 26.3% accurate, 73.1× speedup?

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

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

              \[\leadsto \color{blue}{x + z} \]
            3. Step-by-step derivation
              1. lower-+.f6466.3

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

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

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

                \[\leadsto z \]
              2. Add Preprocessing

              Reproduce

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