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

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

Specification

?
\[\begin{array}{l} \\ \left(x + \sin y\right) + z \cdot \cos y \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
	return (x + sin(y)) + (z * cos(y));
}
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 13 alternatives:

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

Initial Program: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(x + \sin y\right) + z \cdot \cos y \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
	return (x + sin(y)) + (z * cos(y));
}
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} \\ \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}
Derivation
  1. Initial program 99.9%

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

Alternative 2: 81.2% accurate, 0.2× speedup?

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

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

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

\mathbf{elif}\;t\_0 \leq 0.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)\\

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

    if -4e9 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.050000000000000003 or 2e-3 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 1

    1. Initial program 100.0%

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

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

        \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\sin \left(y + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      3. sin-sumN/A

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

        \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
      5. remove-double-negN/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      6. sin-neg-revN/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\left(\mathsf{neg}\left(\sin \left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      7. cos-+PI/2-revN/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      8. cos-neg-revN/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      9. sin-+PI/2-revN/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
      10. cos-sumN/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
      11. cos-+PI/2-revN/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\mathsf{neg}\left(\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)}} \]
      12. sin-+PI/2-revN/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)}\right)} \]
      13. cos-neg-revN/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos y}\right)} \]
      14. lift-cos.f64N/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos y}\right)} \]
    4. Applied rewrites100.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(0 \cdot \sin y\right) \cdot \left(0 \cdot \sin y\right) - \cos y \cdot \cos y}{\color{blue}{\mathsf{neg}\left(\cos y\right)}} \]
      10. sub0-negN/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(0 \cdot \sin y\right) \cdot \left(0 \cdot \sin y\right) - \cos y \cdot \cos y}{\color{blue}{0 - \cos y}} \]
      11. mul0-lftN/A

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

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

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

        \[\leadsto \left(x + \sin y\right) + z \cdot \left(\color{blue}{0 \cdot \sin y} + \cos y\right) \]
      15. mul0-lftN/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \left(\color{blue}{0} + \cos y\right) \]
      16. +-lft-identity100.0

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

        \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{{\cos y}^{1}} \]
      18. metadata-evalN/A

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

        \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\sqrt{{\cos y}^{2}}} \]
      20. pow2N/A

        \[\leadsto \left(x + \sin y\right) + z \cdot \sqrt{\color{blue}{\cos y \cdot \cos y}} \]
    6. Applied rewrites97.9%

      \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\frac{\sqrt{\cos \left(y + y\right) + \cos \left(y - y\right)}}{\sqrt{2}}} \]
    7. Taylor expanded in x around 0

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

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

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

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

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

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

        \[\leadsto \sin y \]

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

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

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

        \[\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)} \]
    12. Recombined 3 regimes into one program.
    13. Add Preprocessing

    Alternative 3: 70.8% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x + \sin y\right) + z \cdot \cos y\\ \mathbf{if}\;t\_0 \leq -0.21 \lor \neg \left(t\_0 \leq 0.2\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\left(z + y\right) + x\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (+ (+ x (sin y)) (* z (cos y)))))
       (if (or (<= t_0 -0.21) (not (<= t_0 0.2))) (+ z x) (+ (+ z y) x))))
    double code(double x, double y, double z) {
    	double t_0 = (x + sin(y)) + (z * cos(y));
    	double tmp;
    	if ((t_0 <= -0.21) || !(t_0 <= 0.2)) {
    		tmp = z + x;
    	} else {
    		tmp = (z + y) + x;
    	}
    	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 = (x + sin(y)) + (z * cos(y))
        if ((t_0 <= (-0.21d0)) .or. (.not. (t_0 <= 0.2d0))) then
            tmp = z + x
        else
            tmp = (z + y) + x
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double t_0 = (x + Math.sin(y)) + (z * Math.cos(y));
    	double tmp;
    	if ((t_0 <= -0.21) || !(t_0 <= 0.2)) {
    		tmp = z + x;
    	} else {
    		tmp = (z + y) + x;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = (x + math.sin(y)) + (z * math.cos(y))
    	tmp = 0
    	if (t_0 <= -0.21) or not (t_0 <= 0.2):
    		tmp = z + x
    	else:
    		tmp = (z + y) + x
    	return tmp
    
    function code(x, y, z)
    	t_0 = Float64(Float64(x + sin(y)) + Float64(z * cos(y)))
    	tmp = 0.0
    	if ((t_0 <= -0.21) || !(t_0 <= 0.2))
    		tmp = Float64(z + x);
    	else
    		tmp = Float64(Float64(z + y) + x);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	t_0 = (x + sin(y)) + (z * cos(y));
    	tmp = 0.0;
    	if ((t_0 <= -0.21) || ~((t_0 <= 0.2)))
    		tmp = z + x;
    	else
    		tmp = (z + y) + x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.21], N[Not[LessEqual[t$95$0, 0.2]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(z + y), $MachinePrecision] + x), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \left(x + \sin y\right) + z \cdot \cos y\\
    \mathbf{if}\;t\_0 \leq -0.21 \lor \neg \left(t\_0 \leq 0.2\right):\\
    \;\;\;\;z + x\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(z + y\right) + x\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -0.209999999999999992 or 0.20000000000000001 < (+.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-+.f6469.7

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

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

      if -0.209999999999999992 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 0.20000000000000001

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

    Alternative 4: 99.9% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

    Alternative 5: 80.3% accurate, 1.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos y \cdot z\\ \mathbf{if}\;z \leq -2.4 \cdot 10^{+95}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -1 \cdot 10^{-188}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+40}:\\ \;\;\;\;\sin y + x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (* (cos y) z)))
       (if (<= z -2.4e+95)
         t_0
         (if (<= z -1e-188) (+ z x) (if (<= z 3.4e+40) (+ (sin y) x) t_0)))))
    double code(double x, double y, double z) {
    	double t_0 = cos(y) * z;
    	double tmp;
    	if (z <= -2.4e+95) {
    		tmp = t_0;
    	} else if (z <= -1e-188) {
    		tmp = z + x;
    	} else if (z <= 3.4e+40) {
    		tmp = sin(y) + x;
    	} 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 = cos(y) * z
        if (z <= (-2.4d+95)) then
            tmp = t_0
        else if (z <= (-1d-188)) then
            tmp = z + x
        else if (z <= 3.4d+40) then
            tmp = sin(y) + x
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double t_0 = Math.cos(y) * z;
    	double tmp;
    	if (z <= -2.4e+95) {
    		tmp = t_0;
    	} else if (z <= -1e-188) {
    		tmp = z + x;
    	} else if (z <= 3.4e+40) {
    		tmp = Math.sin(y) + x;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	t_0 = math.cos(y) * z
    	tmp = 0
    	if z <= -2.4e+95:
    		tmp = t_0
    	elif z <= -1e-188:
    		tmp = z + x
    	elif z <= 3.4e+40:
    		tmp = math.sin(y) + x
    	else:
    		tmp = t_0
    	return tmp
    
    function code(x, y, z)
    	t_0 = Float64(cos(y) * z)
    	tmp = 0.0
    	if (z <= -2.4e+95)
    		tmp = t_0;
    	elseif (z <= -1e-188)
    		tmp = Float64(z + x);
    	elseif (z <= 3.4e+40)
    		tmp = Float64(sin(y) + x);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	t_0 = cos(y) * z;
    	tmp = 0.0;
    	if (z <= -2.4e+95)
    		tmp = t_0;
    	elseif (z <= -1e-188)
    		tmp = z + x;
    	elseif (z <= 3.4e+40)
    		tmp = sin(y) + x;
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -2.4e+95], t$95$0, If[LessEqual[z, -1e-188], N[(z + x), $MachinePrecision], If[LessEqual[z, 3.4e+40], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], t$95$0]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \cos y \cdot z\\
    \mathbf{if}\;z \leq -2.4 \cdot 10^{+95}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;z \leq -1 \cdot 10^{-188}:\\
    \;\;\;\;z + x\\
    
    \mathbf{elif}\;z \leq 3.4 \cdot 10^{+40}:\\
    \;\;\;\;\sin y + x\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z < -2.4e95 or 3.39999999999999989e40 < 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-cos.f64N/A

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

          \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\sin \left(y + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        3. sin-sumN/A

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

          \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
        5. remove-double-negN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        6. sin-neg-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\left(\mathsf{neg}\left(\sin \left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        7. cos-+PI/2-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        8. cos-neg-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        9. sin-+PI/2-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        10. cos-sumN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
        11. cos-+PI/2-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\mathsf{neg}\left(\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)}} \]
        12. sin-+PI/2-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)}\right)} \]
        13. cos-neg-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos y}\right)} \]
        14. lift-cos.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \cos y} \]
      9. 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.2

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

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

      if -2.4e95 < z < -9.9999999999999995e-189

      1. Initial program 100.0%

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

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

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

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

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

      if -9.9999999999999995e-189 < z < 3.39999999999999989e40

      1. Initial program 100.0%

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

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

          \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\sin \left(y + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        3. sin-sumN/A

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

          \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
        5. remove-double-negN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        6. sin-neg-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\left(\mathsf{neg}\left(\sin \left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        7. cos-+PI/2-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        8. cos-neg-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        9. sin-+PI/2-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
        10. cos-sumN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
        11. cos-+PI/2-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\mathsf{neg}\left(\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)}} \]
        12. sin-+PI/2-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)}\right)} \]
        13. cos-neg-revN/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos y}\right)} \]
        14. lift-cos.f64N/A

          \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos y}\right)} \]
      4. Applied rewrites100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x + \sin y} \]
      9. 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.f6496.1

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.4 \cdot 10^{+95}:\\ \;\;\;\;\cos y \cdot z\\ \mathbf{elif}\;z \leq -1 \cdot 10^{-188}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+40}:\\ \;\;\;\;\sin y + x\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot z\\ \end{array} \]
    5. Add Preprocessing

    Alternative 6: 89.3% accurate, 1.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.8 \cdot 10^{+88}:\\ \;\;\;\;\left(y + x\right) + z \cdot \cos y\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+142}:\\ \;\;\;\;\left(x + \sin y\right) + z \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot z\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= z -5.8e+88)
       (+ (+ y x) (* z (cos y)))
       (if (<= z 6e+142) (+ (+ x (sin y)) (* z 1.0)) (* (cos y) z))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (z <= -5.8e+88) {
    		tmp = (y + x) + (z * cos(y));
    	} else if (z <= 6e+142) {
    		tmp = (x + sin(y)) + (z * 1.0);
    	} else {
    		tmp = cos(y) * 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 (z <= (-5.8d+88)) then
            tmp = (y + x) + (z * cos(y))
        else if (z <= 6d+142) then
            tmp = (x + sin(y)) + (z * 1.0d0)
        else
            tmp = cos(y) * z
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double tmp;
    	if (z <= -5.8e+88) {
    		tmp = (y + x) + (z * Math.cos(y));
    	} else if (z <= 6e+142) {
    		tmp = (x + Math.sin(y)) + (z * 1.0);
    	} else {
    		tmp = Math.cos(y) * z;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	tmp = 0
    	if z <= -5.8e+88:
    		tmp = (y + x) + (z * math.cos(y))
    	elif z <= 6e+142:
    		tmp = (x + math.sin(y)) + (z * 1.0)
    	else:
    		tmp = math.cos(y) * z
    	return tmp
    
    function code(x, y, z)
    	tmp = 0.0
    	if (z <= -5.8e+88)
    		tmp = Float64(Float64(y + x) + Float64(z * cos(y)));
    	elseif (z <= 6e+142)
    		tmp = Float64(Float64(x + sin(y)) + Float64(z * 1.0));
    	else
    		tmp = Float64(cos(y) * z);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	tmp = 0.0;
    	if (z <= -5.8e+88)
    		tmp = (y + x) + (z * cos(y));
    	elseif (z <= 6e+142)
    		tmp = (x + sin(y)) + (z * 1.0);
    	else
    		tmp = cos(y) * z;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := If[LessEqual[z, -5.8e+88], N[(N[(y + x), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e+142], N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq -5.8 \cdot 10^{+88}:\\
    \;\;\;\;\left(y + x\right) + z \cdot \cos y\\
    
    \mathbf{elif}\;z \leq 6 \cdot 10^{+142}:\\
    \;\;\;\;\left(x + \sin y\right) + z \cdot 1\\
    
    \mathbf{else}:\\
    \;\;\;\;\cos y \cdot z\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z < -5.7999999999999999e88

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

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

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

      if -5.7999999999999999e88 < z < 5.99999999999999949e142

      1. Initial program 100.0%

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

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

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

        if 5.99999999999999949e142 < z

        1. Initial program 99.6%

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

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

            \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\sin \left(y + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          3. sin-sumN/A

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

            \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
          5. remove-double-negN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          6. sin-neg-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\left(\mathsf{neg}\left(\sin \left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          7. cos-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          8. cos-neg-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          9. sin-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          10. cos-sumN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
          11. cos-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\mathsf{neg}\left(\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)}} \]
          12. sin-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)}\right)} \]
          13. cos-neg-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos y}\right)} \]
          14. lift-cos.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{z \cdot \cos y} \]
        9. 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.f6498.3

            \[\leadsto \color{blue}{\cos y} \cdot z \]
        10. Applied rewrites98.3%

          \[\leadsto \color{blue}{\cos y \cdot z} \]
      5. Recombined 3 regimes into one program.
      6. Final simplification92.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.8 \cdot 10^{+88}:\\ \;\;\;\;\left(y + x\right) + z \cdot \cos y\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+142}:\\ \;\;\;\;\left(x + \sin y\right) + z \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot z\\ \end{array} \]
      7. Add Preprocessing

      Alternative 7: 83.0% accurate, 1.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{-16}:\\ \;\;\;\;\left(y + x\right) + z \cdot \cos y\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+40}:\\ \;\;\;\;\sin y + x\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot z\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (<= z -5.4e-16)
         (+ (+ y x) (* z (cos y)))
         (if (<= z 3.4e+40) (+ (sin y) x) (* (cos y) z))))
      double code(double x, double y, double z) {
      	double tmp;
      	if (z <= -5.4e-16) {
      		tmp = (y + x) + (z * cos(y));
      	} else if (z <= 3.4e+40) {
      		tmp = sin(y) + x;
      	} else {
      		tmp = cos(y) * 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 (z <= (-5.4d-16)) then
              tmp = (y + x) + (z * cos(y))
          else if (z <= 3.4d+40) then
              tmp = sin(y) + x
          else
              tmp = cos(y) * z
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double tmp;
      	if (z <= -5.4e-16) {
      		tmp = (y + x) + (z * Math.cos(y));
      	} else if (z <= 3.4e+40) {
      		tmp = Math.sin(y) + x;
      	} else {
      		tmp = Math.cos(y) * z;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	tmp = 0
      	if z <= -5.4e-16:
      		tmp = (y + x) + (z * math.cos(y))
      	elif z <= 3.4e+40:
      		tmp = math.sin(y) + x
      	else:
      		tmp = math.cos(y) * z
      	return tmp
      
      function code(x, y, z)
      	tmp = 0.0
      	if (z <= -5.4e-16)
      		tmp = Float64(Float64(y + x) + Float64(z * cos(y)));
      	elseif (z <= 3.4e+40)
      		tmp = Float64(sin(y) + x);
      	else
      		tmp = Float64(cos(y) * z);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	tmp = 0.0;
      	if (z <= -5.4e-16)
      		tmp = (y + x) + (z * cos(y));
      	elseif (z <= 3.4e+40)
      		tmp = sin(y) + x;
      	else
      		tmp = cos(y) * z;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := If[LessEqual[z, -5.4e-16], N[(N[(y + x), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.4e+40], N[(N[Sin[y], $MachinePrecision] + x), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;z \leq -5.4 \cdot 10^{-16}:\\
      \;\;\;\;\left(y + x\right) + z \cdot \cos y\\
      
      \mathbf{elif}\;z \leq 3.4 \cdot 10^{+40}:\\
      \;\;\;\;\sin y + x\\
      
      \mathbf{else}:\\
      \;\;\;\;\cos y \cdot z\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if z < -5.39999999999999999e-16

        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-+.f6480.1

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

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

        if -5.39999999999999999e-16 < z < 3.39999999999999989e40

        1. Initial program 100.0%

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

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

            \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\sin \left(y + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          3. sin-sumN/A

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

            \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
          5. remove-double-negN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          6. sin-neg-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\left(\mathsf{neg}\left(\sin \left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          7. cos-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          8. cos-neg-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          9. sin-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          10. cos-sumN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
          11. cos-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\mathsf{neg}\left(\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)}} \]
          12. sin-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)}\right)} \]
          13. cos-neg-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos y}\right)} \]
          14. lift-cos.f64N/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos y}\right)} \]
        4. Applied rewrites100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{x + \sin y} \]
        9. 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.f6493.2

            \[\leadsto \color{blue}{\sin y} + x \]
        10. Applied rewrites93.2%

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

        if 3.39999999999999989e40 < 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-cos.f64N/A

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

            \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\sin \left(y + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          3. sin-sumN/A

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

            \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
          5. remove-double-negN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          6. sin-neg-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\left(\mathsf{neg}\left(\sin \left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          7. cos-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          8. cos-neg-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          9. sin-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          10. cos-sumN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
          11. cos-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\mathsf{neg}\left(\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)}} \]
          12. sin-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)}\right)} \]
          13. cos-neg-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos y}\right)} \]
          14. lift-cos.f64N/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos y}\right)} \]
        4. Applied rewrites99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{z \cdot \cos y} \]
        9. 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.f6487.4

            \[\leadsto \color{blue}{\cos y} \cdot z \]
        10. Applied rewrites87.4%

          \[\leadsto \color{blue}{\cos y \cdot z} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification88.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{-16}:\\ \;\;\;\;\left(y + x\right) + z \cdot \cos y\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+40}:\\ \;\;\;\;\sin y + x\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot z\\ \end{array} \]
      5. Add Preprocessing

      Alternative 8: 81.0% accurate, 1.8× speedup?

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

        1. Initial program 99.9%

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

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

            \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\sin \left(y + \frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          3. sin-sumN/A

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

            \[\leadsto \left(x + \sin y\right) + z \cdot \color{blue}{\frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
          5. remove-double-negN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\sin \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          6. sin-neg-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\left(\mathsf{neg}\left(\sin \left(\mathsf{neg}\left(y\right)\right)\right)\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          7. cos-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          8. cos-neg-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          9. sin-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\cos \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right) - \color{blue}{\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)} \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)} \]
          10. cos-sumN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\cos \left(\left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}} \]
          11. cos-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\color{blue}{\mathsf{neg}\left(\sin \left(\left(\mathsf{neg}\left(y\right)\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)\right)}} \]
          12. sin-+PI/2-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos \left(\mathsf{neg}\left(y\right)\right)}\right)} \]
          13. cos-neg-revN/A

            \[\leadsto \left(x + \sin y\right) + z \cdot \frac{\left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\sin y \cdot \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) - \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot \left(\cos y \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)}{\mathsf{neg}\left(\color{blue}{\cos y}\right)} \]
          14. lift-cos.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{x + \sin y} \]
        9. 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.f6466.9

            \[\leadsto \color{blue}{\sin y} + x \]
        10. Applied rewrites66.9%

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

        if -0.0420000000000000026 < y < 0.20000000000000001

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

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

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

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

      Alternative 9: 70.5% accurate, 5.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -13500000000 \lor \neg \left(y \leq 3.6 \cdot 10^{-20}\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (or (<= y -13500000000.0) (not (<= y 3.6e-20)))
         (+ z x)
         (fma (fma (fma -0.16666666666666666 y (* -0.5 z)) y 1.0) y (+ z x))))
      double code(double x, double y, double z) {
      	double tmp;
      	if ((y <= -13500000000.0) || !(y <= 3.6e-20)) {
      		tmp = z + x;
      	} else {
      		tmp = fma(fma(fma(-0.16666666666666666, y, (-0.5 * z)), y, 1.0), y, (z + x));
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	tmp = 0.0
      	if ((y <= -13500000000.0) || !(y <= 3.6e-20))
      		tmp = Float64(z + x);
      	else
      		tmp = fma(fma(fma(-0.16666666666666666, y, Float64(-0.5 * z)), y, 1.0), y, Float64(z + x));
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := If[Or[LessEqual[y, -13500000000.0], N[Not[LessEqual[y, 3.6e-20]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(-0.16666666666666666 * y + N[(-0.5 * z), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -13500000000 \lor \neg \left(y \leq 3.6 \cdot 10^{-20}\right):\\
      \;\;\;\;z + x\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, y, -0.5 \cdot z\right), y, 1\right), y, z + x\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -1.35e10 or 3.59999999999999974e-20 < 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-+.f6448.0

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

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

        if -1.35e10 < y < 3.59999999999999974e-20

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

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

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

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

      Alternative 10: 70.5% accurate, 6.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -25000000000 \lor \neg \left(y \leq 3.6 \cdot 10^{-20}\right):\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, -0.5, 1\right), z, x + y\right)\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (or (<= y -25000000000.0) (not (<= y 3.6e-20)))
         (+ z x)
         (fma (fma (* y y) -0.5 1.0) z (+ x y))))
      double code(double x, double y, double z) {
      	double tmp;
      	if ((y <= -25000000000.0) || !(y <= 3.6e-20)) {
      		tmp = z + x;
      	} else {
      		tmp = fma(fma((y * y), -0.5, 1.0), z, (x + y));
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	tmp = 0.0
      	if ((y <= -25000000000.0) || !(y <= 3.6e-20))
      		tmp = Float64(z + x);
      	else
      		tmp = fma(fma(Float64(y * y), -0.5, 1.0), z, Float64(x + y));
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := If[Or[LessEqual[y, -25000000000.0], N[Not[LessEqual[y, 3.6e-20]], $MachinePrecision]], N[(z + x), $MachinePrecision], N[(N[(N[(y * y), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * z + N[(x + y), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -25000000000 \lor \neg \left(y \leq 3.6 \cdot 10^{-20}\right):\\
      \;\;\;\;z + x\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, -0.5, 1\right), z, x + y\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -2.5e10 or 3.59999999999999974e-20 < 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-+.f6448.0

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

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

        if -2.5e10 < y < 3.59999999999999974e-20

        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. lower-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 11: 50.7% accurate, 13.2× speedup?

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

            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

                \[\leadsto x + \color{blue}{y} \]
              3. Step-by-step derivation
                1. Applied rewrites60.4%

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

                if -1.7e-5 < x < 1.7500000000000002e-64

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

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

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

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

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

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

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

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

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

                Alternative 12: 66.3% accurate, 53.0× speedup?

                \[\begin{array}{l} \\ z + x \end{array} \]
                (FPCore (x y z) :precision binary64 (+ z x))
                double code(double x, double y, double z) {
                	return z + x;
                }
                
                real(8) function code(x, y, z)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    code = z + x
                end function
                
                public static double code(double x, double y, double z) {
                	return z + x;
                }
                
                def code(x, y, z):
                	return z + x
                
                function code(x, y, z)
                	return Float64(z + x)
                end
                
                function tmp = code(x, y, z)
                	tmp = z + x;
                end
                
                code[x_, y_, z_] := N[(z + x), $MachinePrecision]
                
                \begin{array}{l}
                
                \\
                z + x
                \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-+.f6468.3

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

                  \[\leadsto \color{blue}{z + x} \]
                6. Add Preprocessing

                Alternative 13: 38.5% accurate, 53.0× speedup?

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto x + \color{blue}{y} \]
                  3. Step-by-step derivation
                    1. Applied rewrites40.8%

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

                    Reproduce

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