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

Percentage Accurate: 99.9% → 99.9%
Time: 8.3s
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));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
	return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z):
	return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z)
	return Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
end
function tmp = code(x, y, z)
	tmp = (x + sin(y)) + (z * cos(y));
end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.3% accurate, 1.5× speedup?

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

\\
\begin{array}{l}
t_0 := z \cdot \cos y + \frac{1}{\frac{1}{x}}\\
\mathbf{if}\;z \leq -680000000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 0.0005:\\
\;\;\;\;\mathsf{fma}\left(1, z, x + \sin y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -6.8e11 or 5.0000000000000001e-4 < z

    1. Initial program 99.8%

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

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

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

        \[\leadsto \color{blue}{\frac{\sin y \cdot \sin y - x \cdot x}{\sin y - x}} + z \cdot \cos y \]
      4. clear-numN/A

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\sin y - x}{\sin y \cdot \sin y - x \cdot x}}} + z \cdot \cos y \]
      7. lower--.f64N/A

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

        \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{\sin y \cdot \sin y - x \cdot x}}} + z \cdot \cos y \]
      9. pow2N/A

        \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{{\sin y}^{2}} - x \cdot x}} + z \cdot \cos y \]
      10. lower-pow.f64N/A

        \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{{\sin y}^{2}} - x \cdot x}} + z \cdot \cos y \]
      11. lower-*.f6476.5

        \[\leadsto \frac{1}{\frac{\sin y - x}{{\sin y}^{2} - \color{blue}{x \cdot x}}} + z \cdot \cos y \]
    4. Applied rewrites76.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{\sin y - x}{{\sin y}^{2} - x \cdot x}}} + z \cdot \cos y \]
    5. Taylor expanded in x around inf

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
    6. Step-by-step derivation
      1. lower-/.f6499.6

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
    7. Applied rewrites99.6%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]

    if -6.8e11 < z < 5.0000000000000001e-4

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 3: 91.7% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(\cos y, z, x + y\right)\\ \mathbf{if}\;z \leq -3.6 \cdot 10^{+83}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 230000:\\ \;\;\;\;\mathsf{fma}\left(1, z, x + \sin y\right)\\ \mathbf{elif}\;z \leq 9 \cdot 10^{+108}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\cos y}{x} \cdot z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (fma (cos y) z (+ x y))))
       (if (<= z -3.6e+83)
         t_0
         (if (<= z 230000.0)
           (fma 1.0 z (+ x (sin y)))
           (if (<= z 9e+108) (fma (* (/ (cos y) x) z) x x) t_0)))))
    double code(double x, double y, double z) {
    	double t_0 = fma(cos(y), z, (x + y));
    	double tmp;
    	if (z <= -3.6e+83) {
    		tmp = t_0;
    	} else if (z <= 230000.0) {
    		tmp = fma(1.0, z, (x + sin(y)));
    	} else if (z <= 9e+108) {
    		tmp = fma(((cos(y) / x) * z), x, x);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = fma(cos(y), z, Float64(x + y))
    	tmp = 0.0
    	if (z <= -3.6e+83)
    		tmp = t_0;
    	elseif (z <= 230000.0)
    		tmp = fma(1.0, z, Float64(x + sin(y)));
    	elseif (z <= 9e+108)
    		tmp = fma(Float64(Float64(cos(y) / x) * z), x, x);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+83], t$95$0, If[LessEqual[z, 230000.0], N[(1.0 * z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e+108], N[(N[(N[(N[Cos[y], $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision] * x + x), $MachinePrecision], t$95$0]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \mathsf{fma}\left(\cos y, z, x + y\right)\\
    \mathbf{if}\;z \leq -3.6 \cdot 10^{+83}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;z \leq 230000:\\
    \;\;\;\;\mathsf{fma}\left(1, z, x + \sin y\right)\\
    
    \mathbf{elif}\;z \leq 9 \cdot 10^{+108}:\\
    \;\;\;\;\mathsf{fma}\left(\frac{\cos y}{x} \cdot z, x, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z < -3.5999999999999997e83 or 9e108 < z

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

      if -3.5999999999999997e83 < z < 2.3e5

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

        if 2.3e5 < z < 9e108

        1. Initial program 99.5%

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

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

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

            \[\leadsto \color{blue}{\frac{\sin y \cdot \sin y - x \cdot x}{\sin y - x}} + z \cdot \cos y \]
          4. clear-numN/A

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

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

            \[\leadsto \frac{1}{\color{blue}{\frac{\sin y - x}{\sin y \cdot \sin y - x \cdot x}}} + z \cdot \cos y \]
          7. lower--.f64N/A

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

            \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{\sin y \cdot \sin y - x \cdot x}}} + z \cdot \cos y \]
          9. pow2N/A

            \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{{\sin y}^{2}} - x \cdot x}} + z \cdot \cos y \]
          10. lower-pow.f64N/A

            \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{{\sin y}^{2}} - x \cdot x}} + z \cdot \cos y \]
          11. lower-*.f6491.4

            \[\leadsto \frac{1}{\frac{\sin y - x}{{\sin y}^{2} - \color{blue}{x \cdot x}}} + z \cdot \cos y \]
        4. Applied rewrites91.4%

          \[\leadsto \color{blue}{\frac{1}{\frac{\sin y - x}{{\sin y}^{2} - x \cdot x}}} + z \cdot \cos y \]
        5. Taylor expanded in x around inf

          \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
        6. Step-by-step derivation
          1. lower-/.f6499.5

            \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
        7. Applied rewrites99.5%

          \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
        8. Taylor expanded in x around inf

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{\cos y}{x}, z, \color{blue}{\frac{\sin y}{x}}\right), x, x\right) \]
          12. lower-sin.f6495.3

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

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

          \[\leadsto \mathsf{fma}\left(\frac{z \cdot \cos y}{x}, x, x\right) \]
        12. Step-by-step derivation
          1. Applied rewrites95.3%

            \[\leadsto \mathsf{fma}\left(\frac{\cos y}{x} \cdot z, x, x\right) \]
        13. Recombined 3 regimes into one program.
        14. Final simplification92.5%

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.6 \cdot 10^{+83}:\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\ \mathbf{elif}\;z \leq 230000:\\ \;\;\;\;\mathsf{fma}\left(1, z, x + \sin y\right)\\ \mathbf{elif}\;z \leq 9 \cdot 10^{+108}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\cos y}{x} \cdot z, x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\ \end{array} \]
        15. Add Preprocessing

        Alternative 4: 90.4% accurate, 1.7× speedup?

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

          1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

          if -3.5999999999999997e83 < z < 1.4499999999999999e70

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 5: 81.0% accurate, 1.8× speedup?

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

            1. Initial program 99.8%

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

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

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

                \[\leadsto \color{blue}{\frac{\sin y \cdot \sin y - x \cdot x}{\sin y - x}} + z \cdot \cos y \]
              4. clear-numN/A

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

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

                \[\leadsto \frac{1}{\color{blue}{\frac{\sin y - x}{\sin y \cdot \sin y - x \cdot x}}} + z \cdot \cos y \]
              7. lower--.f64N/A

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

                \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{\sin y \cdot \sin y - x \cdot x}}} + z \cdot \cos y \]
              9. pow2N/A

                \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{{\sin y}^{2}} - x \cdot x}} + z \cdot \cos y \]
              10. lower-pow.f64N/A

                \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{{\sin y}^{2}} - x \cdot x}} + z \cdot \cos y \]
              11. lower-*.f6475.8

                \[\leadsto \frac{1}{\frac{\sin y - x}{{\sin y}^{2} - \color{blue}{x \cdot x}}} + z \cdot \cos y \]
            4. Applied rewrites75.8%

              \[\leadsto \color{blue}{\frac{1}{\frac{\sin y - x}{{\sin y}^{2} - x \cdot x}}} + z \cdot \cos y \]
            5. Taylor expanded in x around inf

              \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
            6. Step-by-step derivation
              1. lower-/.f6476.1

                \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
            7. Applied rewrites76.1%

              \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
            8. Taylor expanded in x around inf

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{\cos y}{x}, z, \color{blue}{\frac{\sin y}{x}}\right), x, x\right) \]
              12. lower-sin.f6483.4

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

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

              \[\leadsto x + \color{blue}{\sin y} \]
            12. Step-by-step derivation
              1. Applied rewrites55.5%

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

              if -0.0134999999999999998 < y < 8.6e10

              1. Initial program 100.0%

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

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

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

                  \[\leadsto \color{blue}{\frac{\sin y \cdot \sin y - x \cdot x}{\sin y - x}} + z \cdot \cos y \]
                4. clear-numN/A

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

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

                  \[\leadsto \frac{1}{\color{blue}{\frac{\sin y - x}{\sin y \cdot \sin y - x \cdot x}}} + z \cdot \cos y \]
                7. lower--.f64N/A

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

                  \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{\sin y \cdot \sin y - x \cdot x}}} + z \cdot \cos y \]
                9. pow2N/A

                  \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{{\sin y}^{2}} - x \cdot x}} + z \cdot \cos y \]
                10. lower-pow.f64N/A

                  \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{{\sin y}^{2}} - x \cdot x}} + z \cdot \cos y \]
                11. lower-*.f6473.3

                  \[\leadsto \frac{1}{\frac{\sin y - x}{{\sin y}^{2} - \color{blue}{x \cdot x}}} + z \cdot \cos y \]
              4. Applied rewrites73.3%

                \[\leadsto \color{blue}{\frac{1}{\frac{\sin y - x}{{\sin y}^{2} - x \cdot x}}} + z \cdot \cos y \]
              5. Taylor expanded in x around inf

                \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
              6. Step-by-step derivation
                1. lower-/.f6492.3

                  \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
              7. Applied rewrites92.3%

                \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
              8. Taylor expanded in y around 0

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

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

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

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

                  \[\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)} \]
                5. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.0135:\\ \;\;\;\;x + \sin y\\ \mathbf{elif}\;y \leq 86000000000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right), y, x + z\right)\\ \mathbf{else}:\\ \;\;\;\;x + \sin y\\ \end{array} \]
              15. Add Preprocessing

              Alternative 6: 82.7% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 7: 70.4% accurate, 5.4× speedup?

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

                  1. Initial program 99.8%

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

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

                      \[\leadsto \color{blue}{z + x} \]
                    2. lower-+.f6437.1

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

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

                  if -17 < y < 4.4e6

                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 8: 70.0% accurate, 6.4× speedup?

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

                  1. Initial program 99.8%

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

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

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

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

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

                  if -3e48 < y < 1.55e13

                  1. Initial program 100.0%

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

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

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

                      \[\leadsto \color{blue}{\frac{\sin y \cdot \sin y - x \cdot x}{\sin y - x}} + z \cdot \cos y \]
                    4. clear-numN/A

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

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

                      \[\leadsto \frac{1}{\color{blue}{\frac{\sin y - x}{\sin y \cdot \sin y - x \cdot x}}} + z \cdot \cos y \]
                    7. lower--.f64N/A

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

                      \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{\sin y \cdot \sin y - x \cdot x}}} + z \cdot \cos y \]
                    9. pow2N/A

                      \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{{\sin y}^{2}} - x \cdot x}} + z \cdot \cos y \]
                    10. lower-pow.f64N/A

                      \[\leadsto \frac{1}{\frac{\sin y - x}{\color{blue}{{\sin y}^{2}} - x \cdot x}} + z \cdot \cos y \]
                    11. lower-*.f6474.2

                      \[\leadsto \frac{1}{\frac{\sin y - x}{{\sin y}^{2} - \color{blue}{x \cdot x}}} + z \cdot \cos y \]
                  4. Applied rewrites74.2%

                    \[\leadsto \color{blue}{\frac{1}{\frac{\sin y - x}{{\sin y}^{2} - x \cdot x}}} + z \cdot \cos y \]
                  5. Taylor expanded in x around inf

                    \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
                  6. Step-by-step derivation
                    1. lower-/.f6491.1

                      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
                  7. Applied rewrites91.1%

                    \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} + z \cdot \cos y \]
                  8. Taylor expanded in y around 0

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

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

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

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

                      \[\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)} \]
                    5. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3 \cdot 10^{+48}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 15500000000000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666 \cdot y, y, 1\right), y, x + z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
                  15. Add Preprocessing

                  Alternative 9: 70.4% accurate, 6.4× speedup?

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

                    1. Initial program 99.8%

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

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

                        \[\leadsto \color{blue}{z + x} \]
                      2. lower-+.f6437.1

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

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

                    if -17 < y < 4.5e6

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 10: 69.7% accurate, 11.1× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -8.6 \cdot 10^{+17}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{-35}:\\ \;\;\;\;\left(x + y\right) + z\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (<= y -8.6e+17) (+ x z) (if (<= y 2.5e-35) (+ (+ x y) z) (+ x z))))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if (y <= -8.6e+17) {
                  		tmp = x + z;
                  	} else if (y <= 2.5e-35) {
                  		tmp = (x + y) + z;
                  	} else {
                  		tmp = x + z;
                  	}
                  	return tmp;
                  }
                  
                  real(8) function code(x, y, z)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8), intent (in) :: z
                      real(8) :: tmp
                      if (y <= (-8.6d+17)) then
                          tmp = x + z
                      else if (y <= 2.5d-35) 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 <= -8.6e+17) {
                  		tmp = x + z;
                  	} else if (y <= 2.5e-35) {
                  		tmp = (x + y) + z;
                  	} else {
                  		tmp = x + z;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y, z):
                  	tmp = 0
                  	if y <= -8.6e+17:
                  		tmp = x + z
                  	elif y <= 2.5e-35:
                  		tmp = (x + y) + z
                  	else:
                  		tmp = x + z
                  	return tmp
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if (y <= -8.6e+17)
                  		tmp = Float64(x + z);
                  	elseif (y <= 2.5e-35)
                  		tmp = Float64(Float64(x + y) + z);
                  	else
                  		tmp = Float64(x + z);
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y, z)
                  	tmp = 0.0;
                  	if (y <= -8.6e+17)
                  		tmp = x + z;
                  	elseif (y <= 2.5e-35)
                  		tmp = (x + y) + z;
                  	else
                  		tmp = x + z;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_, z_] := If[LessEqual[y, -8.6e+17], N[(x + z), $MachinePrecision], If[LessEqual[y, 2.5e-35], N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision], N[(x + z), $MachinePrecision]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;y \leq -8.6 \cdot 10^{+17}:\\
                  \;\;\;\;x + z\\
                  
                  \mathbf{elif}\;y \leq 2.5 \cdot 10^{-35}:\\
                  \;\;\;\;\left(x + y\right) + z\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;x + z\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if y < -8.6e17 or 2.49999999999999982e-35 < y

                    1. Initial program 99.8%

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

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

                        \[\leadsto \color{blue}{z + x} \]
                      2. lower-+.f6442.5

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

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

                    if -8.6e17 < y < 2.49999999999999982e-35

                    1. Initial program 100.0%

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

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

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

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

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

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

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.6 \cdot 10^{+17}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 2.5 \cdot 10^{-35}:\\ \;\;\;\;\left(x + y\right) + z\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
                  5. Add Preprocessing

                  Alternative 11: 66.3% accurate, 53.0× speedup?

                  \[\begin{array}{l} \\ x + z \end{array} \]
                  (FPCore (x y z) :precision binary64 (+ x z))
                  double code(double x, double y, double z) {
                  	return x + z;
                  }
                  
                  real(8) function code(x, y, z)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8), intent (in) :: z
                      code = x + z
                  end function
                  
                  public static double code(double x, double y, double z) {
                  	return x + z;
                  }
                  
                  def code(x, y, z):
                  	return x + z
                  
                  function code(x, y, z)
                  	return Float64(x + z)
                  end
                  
                  function tmp = code(x, y, z)
                  	tmp = x + z;
                  end
                  
                  code[x_, y_, z_] := N[(x + z), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  x + z
                  \end{array}
                  
                  Derivation
                  1. Initial program 99.9%

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

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

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

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

                    \[\leadsto \color{blue}{z + x} \]
                  6. Final simplification65.4%

                    \[\leadsto x + z \]
                  7. Add Preprocessing

                  Reproduce

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