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

Percentage Accurate: 99.9% → 99.9%
Time: 7.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));
}
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: 80.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y + \left(x + \sin y\right)\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{+20}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;t\_0 \leq -0.05:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;t\_0 \leq 10^{-10}:\\ \;\;\;\;\left(x + y\right) + z\\ \mathbf{elif}\;t\_0 \leq 3:\\ \;\;\;\;\sin y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ (* z (cos y)) (+ x (sin y)))))
   (if (<= t_0 -2e+20)
     (+ x z)
     (if (<= t_0 -0.05)
       (sin y)
       (if (<= t_0 1e-10) (+ (+ x y) z) (if (<= t_0 3.0) (sin y) (+ x z)))))))
double code(double x, double y, double z) {
	double t_0 = (z * cos(y)) + (x + sin(y));
	double tmp;
	if (t_0 <= -2e+20) {
		tmp = x + z;
	} else if (t_0 <= -0.05) {
		tmp = sin(y);
	} else if (t_0 <= 1e-10) {
		tmp = (x + y) + z;
	} else if (t_0 <= 3.0) {
		tmp = sin(y);
	} 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) :: t_0
    real(8) :: tmp
    t_0 = (z * cos(y)) + (x + sin(y))
    if (t_0 <= (-2d+20)) then
        tmp = x + z
    else if (t_0 <= (-0.05d0)) then
        tmp = sin(y)
    else if (t_0 <= 1d-10) then
        tmp = (x + y) + z
    else if (t_0 <= 3.0d0) then
        tmp = sin(y)
    else
        tmp = x + z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (z * Math.cos(y)) + (x + Math.sin(y));
	double tmp;
	if (t_0 <= -2e+20) {
		tmp = x + z;
	} else if (t_0 <= -0.05) {
		tmp = Math.sin(y);
	} else if (t_0 <= 1e-10) {
		tmp = (x + y) + z;
	} else if (t_0 <= 3.0) {
		tmp = Math.sin(y);
	} else {
		tmp = x + z;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (z * math.cos(y)) + (x + math.sin(y))
	tmp = 0
	if t_0 <= -2e+20:
		tmp = x + z
	elif t_0 <= -0.05:
		tmp = math.sin(y)
	elif t_0 <= 1e-10:
		tmp = (x + y) + z
	elif t_0 <= 3.0:
		tmp = math.sin(y)
	else:
		tmp = x + z
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(z * cos(y)) + Float64(x + sin(y)))
	tmp = 0.0
	if (t_0 <= -2e+20)
		tmp = Float64(x + z);
	elseif (t_0 <= -0.05)
		tmp = sin(y);
	elseif (t_0 <= 1e-10)
		tmp = Float64(Float64(x + y) + z);
	elseif (t_0 <= 3.0)
		tmp = sin(y);
	else
		tmp = Float64(x + z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (z * cos(y)) + (x + sin(y));
	tmp = 0.0;
	if (t_0 <= -2e+20)
		tmp = x + z;
	elseif (t_0 <= -0.05)
		tmp = sin(y);
	elseif (t_0 <= 1e-10)
		tmp = (x + y) + z;
	elseif (t_0 <= 3.0)
		tmp = sin(y);
	else
		tmp = x + z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+20], N[(x + z), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[Sin[y], $MachinePrecision], If[LessEqual[t$95$0, 1e-10], N[(N[(x + y), $MachinePrecision] + z), $MachinePrecision], If[LessEqual[t$95$0, 3.0], N[Sin[y], $MachinePrecision], N[(x + z), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

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

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


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

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{z + x} \]
      2. lower-+.f6475.9

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

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

    if -2e20 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.050000000000000003 or 1.00000000000000004e-10 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 3

    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. flip3-+N/A

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(x + \sin y\right) \cdot \left(x + \sin y\right) + \left(\left(z \cdot \cos y\right) \cdot \left(z \cdot \cos y\right) - \left(x + \sin y\right) \cdot \left(z \cdot \cos y\right)\right)}{{\left(x + \sin y\right)}^{3} + {\left(z \cdot \cos y\right)}^{3}}}} \]
      5. clear-numN/A

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{{\left(\left(x + \sin y\right) + z \cdot \cos y\right)}^{-1}}} \]
    4. Applied rewrites99.5%

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

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

        \[\leadsto \color{blue}{\sin y + x} \]
      2. lower-+.f64N/A

        \[\leadsto \color{blue}{\sin y + x} \]
      3. lower-sin.f6494.6

        \[\leadsto \color{blue}{\sin y} + x \]
    7. Applied rewrites94.6%

      \[\leadsto \color{blue}{\sin y + x} \]
    8. Taylor expanded in x around 0

      \[\leadsto \sin y \]
    9. Step-by-step derivation
      1. Applied rewrites93.1%

        \[\leadsto \sin y \]

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

      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-+.f64100.0

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

        \[\leadsto \color{blue}{\left(y + x\right) + z} \]
    10. Recombined 3 regimes into one program.
    11. Final simplification82.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot \cos y + \left(x + \sin y\right) \leq -2 \cdot 10^{+20}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;z \cdot \cos y + \left(x + \sin y\right) \leq -0.05:\\ \;\;\;\;\sin y\\ \mathbf{elif}\;z \cdot \cos y + \left(x + \sin y\right) \leq 10^{-10}:\\ \;\;\;\;\left(x + y\right) + z\\ \mathbf{elif}\;z \cdot \cos y + \left(x + \sin y\right) \leq 3:\\ \;\;\;\;\sin y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
    12. Add Preprocessing

    Alternative 3: 89.2% accurate, 1.0× speedup?

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

      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-+.f6489.3

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

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

      if -1.66e22 < x < 9e-72

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

      if 9e-72 < x

      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 rewrites91.1%

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

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

      Alternative 4: 88.9% accurate, 1.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -2.65 \cdot 10^{+67}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{+21}:\\ \;\;\;\;\mathsf{fma}\left(1, z, x + \sin y\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+182}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (* z (cos y))))
         (if (<= z -2.65e+67)
           t_0
           (if (<= z 3.9e+21)
             (fma 1.0 z (+ x (sin y)))
             (if (<= z 1.8e+182) 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 <= -2.65e+67) {
      		tmp = t_0;
      	} else if (z <= 3.9e+21) {
      		tmp = fma(1.0, z, (x + sin(y)));
      	} else if (z <= 1.8e+182) {
      		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 <= -2.65e+67)
      		tmp = t_0;
      	elseif (z <= 3.9e+21)
      		tmp = fma(1.0, z, Float64(x + sin(y)));
      	elseif (z <= 1.8e+182)
      		tmp = t_0;
      	else
      		tmp = fma(cos(y), z, Float64(x + y));
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.65e+67], t$95$0, If[LessEqual[z, 3.9e+21], N[(1.0 * z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e+182], t$95$0, N[(N[Cos[y], $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := z \cdot \cos y\\
      \mathbf{if}\;z \leq -2.65 \cdot 10^{+67}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;z \leq 3.9 \cdot 10^{+21}:\\
      \;\;\;\;\mathsf{fma}\left(1, z, x + \sin y\right)\\
      
      \mathbf{elif}\;z \leq 1.8 \cdot 10^{+182}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if z < -2.65e67 or 3.9e21 < z < 1.8e182

        1. Initial program 99.8%

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

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

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

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

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

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

        if -2.65e67 < z < 3.9e21

        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 rewrites97.4%

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

          if 1.8e182 < z

          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(\cos y, z, \color{blue}{x + y}\right) \]
          6. Step-by-step derivation
            1. +-commutativeN/A

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.65 \cdot 10^{+67}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{+21}:\\ \;\;\;\;\mathsf{fma}\left(1, z, x + \sin y\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+182}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\cos y, z, x + y\right)\\ \end{array} \]
        9. Add Preprocessing

        Alternative 5: 88.9% accurate, 1.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -2.65 \cdot 10^{+67}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{+21}:\\ \;\;\;\;\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))))
           (if (<= z -2.65e+67)
             t_0
             (if (<= z 3.9e+21) (fma 1.0 z (+ x (sin y))) t_0))))
        double code(double x, double y, double z) {
        	double t_0 = z * cos(y);
        	double tmp;
        	if (z <= -2.65e+67) {
        		tmp = t_0;
        	} else if (z <= 3.9e+21) {
        		tmp = fma(1.0, z, (x + sin(y)));
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        function code(x, y, z)
        	t_0 = Float64(z * cos(y))
        	tmp = 0.0
        	if (z <= -2.65e+67)
        		tmp = t_0;
        	elseif (z <= 3.9e+21)
        		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[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.65e+67], t$95$0, If[LessEqual[z, 3.9e+21], 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\\
        \mathbf{if}\;z \leq -2.65 \cdot 10^{+67}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;z \leq 3.9 \cdot 10^{+21}:\\
        \;\;\;\;\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 < -2.65e67 or 3.9e21 < z

          1. Initial program 99.9%

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

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

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

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

              \[\leadsto \color{blue}{\cos y} \cdot z \]
          5. Applied rewrites83.6%

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

          if -2.65e67 < z < 3.9e21

          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 rewrites97.4%

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

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

          Alternative 6: 83.6% accurate, 1.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \cos y\\ \mathbf{if}\;z \leq -2.3 \cdot 10^{+14}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 50000000000:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (* z (cos y))))
             (if (<= z -2.3e+14) t_0 (if (<= z 50000000000.0) (+ x (sin y)) t_0))))
          double code(double x, double y, double z) {
          	double t_0 = z * cos(y);
          	double tmp;
          	if (z <= -2.3e+14) {
          		tmp = t_0;
          	} else if (z <= 50000000000.0) {
          		tmp = x + sin(y);
          	} else {
          		tmp = t_0;
          	}
          	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) :: t_0
              real(8) :: tmp
              t_0 = z * cos(y)
              if (z <= (-2.3d+14)) then
                  tmp = t_0
              else if (z <= 50000000000.0d0) then
                  tmp = x + sin(y)
              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 <= -2.3e+14) {
          		tmp = t_0;
          	} else if (z <= 50000000000.0) {
          		tmp = x + Math.sin(y);
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	t_0 = z * math.cos(y)
          	tmp = 0
          	if z <= -2.3e+14:
          		tmp = t_0
          	elif z <= 50000000000.0:
          		tmp = x + math.sin(y)
          	else:
          		tmp = t_0
          	return tmp
          
          function code(x, y, z)
          	t_0 = Float64(z * cos(y))
          	tmp = 0.0
          	if (z <= -2.3e+14)
          		tmp = t_0;
          	elseif (z <= 50000000000.0)
          		tmp = Float64(x + sin(y));
          	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 <= -2.3e+14)
          		tmp = t_0;
          	elseif (z <= 50000000000.0)
          		tmp = x + sin(y);
          	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, -2.3e+14], t$95$0, If[LessEqual[z, 50000000000.0], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := z \cdot \cos y\\
          \mathbf{if}\;z \leq -2.3 \cdot 10^{+14}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;z \leq 50000000000:\\
          \;\;\;\;x + \sin y\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if z < -2.3e14 or 5e10 < z

            1. Initial program 99.9%

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

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

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

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

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

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

            if -2.3e14 < z < 5e10

            1. Initial program 100.0%

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

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

                \[\leadsto \color{blue}{\sin y + x} \]
              2. lower-+.f64N/A

                \[\leadsto \color{blue}{\sin y + x} \]
              3. lower-sin.f6487.1

                \[\leadsto \color{blue}{\sin y} + x \]
            5. Applied rewrites87.1%

              \[\leadsto \color{blue}{\sin y + x} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification85.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.3 \cdot 10^{+14}:\\ \;\;\;\;z \cdot \cos y\\ \mathbf{elif}\;z \leq 50000000000:\\ \;\;\;\;x + \sin y\\ \mathbf{else}:\\ \;\;\;\;z \cdot \cos y\\ \end{array} \]
          5. Add Preprocessing

          Alternative 7: 80.7% accurate, 1.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \sin y\\ \mathbf{if}\;y \leq -4 \cdot 10^{+30}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 19000000000000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, 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 -4e+30)
               t_0
               (if (<= y 19000000000000.0) (fma (fma (* -0.5 y) z 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 <= -4e+30) {
          		tmp = t_0;
          	} else if (y <= 19000000000000.0) {
          		tmp = fma(fma((-0.5 * y), z, 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 <= -4e+30)
          		tmp = t_0;
          	elseif (y <= 19000000000000.0)
          		tmp = fma(fma(Float64(-0.5 * y), z, 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, -4e+30], t$95$0, If[LessEqual[y, 19000000000000.0], N[(N[(N[(-0.5 * y), $MachinePrecision] * z + 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 -4 \cdot 10^{+30}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;y \leq 19000000000000:\\
          \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot y, z, 1\right), y, x + z\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < -4.0000000000000001e30 or 1.9e13 < y

            1. Initial program 99.9%

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

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

                \[\leadsto \color{blue}{\sin y + x} \]
              2. lower-+.f64N/A

                \[\leadsto \color{blue}{\sin y + x} \]
              3. lower-sin.f6467.3

                \[\leadsto \color{blue}{\sin y} + x \]
            5. Applied rewrites67.3%

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

            if -4.0000000000000001e30 < y < 1.9e13

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

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

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

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

          Alternative 8: 70.2% accurate, 6.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{+33}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{+19}:\\ \;\;\;\;\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 -4.5e+33)
             (+ x z)
             (if (<= y 1.25e+19) (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 <= -4.5e+33) {
          		tmp = x + z;
          	} else if (y <= 1.25e+19) {
          		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 <= -4.5e+33)
          		tmp = Float64(x + z);
          	elseif (y <= 1.25e+19)
          		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, -4.5e+33], N[(x + z), $MachinePrecision], If[LessEqual[y, 1.25e+19], 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 -4.5 \cdot 10^{+33}:\\
          \;\;\;\;x + z\\
          
          \mathbf{elif}\;y \leq 1.25 \cdot 10^{+19}:\\
          \;\;\;\;\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 < -4.5e33 or 1.25e19 < y

            1. Initial program 99.9%

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

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

                \[\leadsto \color{blue}{z + x} \]
              2. lower-+.f6439.9

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

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

            if -4.5e33 < y < 1.25e19

            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-+.f6496.2

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{+33}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{+19}:\\ \;\;\;\;\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 9: 70.3% accurate, 11.1× speedup?

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

            1. Initial program 99.9%

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

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

                \[\leadsto \color{blue}{z + x} \]
              2. lower-+.f6439.9

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

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

            if -4.5e33 < y < 9.5e17

            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-+.f6496.0

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

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

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

          Alternative 10: 67.8% accurate, 13.2× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-86}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq 1.02 \cdot 10^{-202}:\\ \;\;\;\;z + y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (if (<= x -1.5e-86) (+ x z) (if (<= x 1.02e-202) (+ z y) (+ x z))))
          double code(double x, double y, double z) {
          	double tmp;
          	if (x <= -1.5e-86) {
          		tmp = x + z;
          	} else if (x <= 1.02e-202) {
          		tmp = z + y;
          	} 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 (x <= (-1.5d-86)) then
                  tmp = x + z
              else if (x <= 1.02d-202) then
                  tmp = z + y
              else
                  tmp = x + z
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z) {
          	double tmp;
          	if (x <= -1.5e-86) {
          		tmp = x + z;
          	} else if (x <= 1.02e-202) {
          		tmp = z + y;
          	} else {
          		tmp = x + z;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	tmp = 0
          	if x <= -1.5e-86:
          		tmp = x + z
          	elif x <= 1.02e-202:
          		tmp = z + y
          	else:
          		tmp = x + z
          	return tmp
          
          function code(x, y, z)
          	tmp = 0.0
          	if (x <= -1.5e-86)
          		tmp = Float64(x + z);
          	elseif (x <= 1.02e-202)
          		tmp = Float64(z + y);
          	else
          		tmp = Float64(x + z);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	tmp = 0.0;
          	if (x <= -1.5e-86)
          		tmp = x + z;
          	elseif (x <= 1.02e-202)
          		tmp = z + y;
          	else
          		tmp = x + z;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := If[LessEqual[x, -1.5e-86], N[(x + z), $MachinePrecision], If[LessEqual[x, 1.02e-202], N[(z + y), $MachinePrecision], N[(x + z), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;x \leq -1.5 \cdot 10^{-86}:\\
          \;\;\;\;x + z\\
          
          \mathbf{elif}\;x \leq 1.02 \cdot 10^{-202}:\\
          \;\;\;\;z + y\\
          
          \mathbf{else}:\\
          \;\;\;\;x + z\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x < -1.5e-86 or 1.01999999999999997e-202 < x

            1. Initial program 99.9%

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

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

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

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

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

            if -1.5e-86 < x < 1.01999999999999997e-202

            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. flip3-+N/A

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

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

                \[\leadsto \color{blue}{\frac{1}{\frac{\left(x + \sin y\right) \cdot \left(x + \sin y\right) + \left(\left(z \cdot \cos y\right) \cdot \left(z \cdot \cos y\right) - \left(x + \sin y\right) \cdot \left(z \cdot \cos y\right)\right)}{{\left(x + \sin y\right)}^{3} + {\left(z \cdot \cos y\right)}^{3}}}} \]
              5. clear-numN/A

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

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

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

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

                \[\leadsto \frac{1}{\color{blue}{{\left(\left(x + \sin y\right) + z \cdot \cos y\right)}^{-1}}} \]
            4. Applied rewrites99.8%

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

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

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

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

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

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

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

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

                \[\leadsto z + \color{blue}{y} \]
            10. Recombined 2 regimes into one program.
            11. Final simplification65.2%

              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-86}:\\ \;\;\;\;x + z\\ \mathbf{elif}\;x \leq 1.02 \cdot 10^{-202}:\\ \;\;\;\;z + y\\ \mathbf{else}:\\ \;\;\;\;x + z\\ \end{array} \]
            12. Add Preprocessing

            Alternative 11: 66.2% 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-+.f6461.6

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

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

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

            Reproduce

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