Diagrams.ThreeD.Transform:aboutX from diagrams-lib-1.3.0.3, A

Percentage Accurate: 99.8% → 99.8%
Time: 10.3s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x \cdot \cos y - z \cdot \sin y \end{array} \]
(FPCore (x y z) :precision binary64 (- (* x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
	return (x * cos(y)) - (z * sin(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 * cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
	return (x * Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z):
	return (x * math.cos(y)) - (z * math.sin(y))
function code(x, y, z)
	return Float64(Float64(x * cos(y)) - Float64(z * sin(y)))
end
function tmp = code(x, y, z)
	tmp = (x * cos(y)) - (z * sin(y));
end
code[x_, y_, z_] := N[(N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \cos y - z \cdot \sin 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 9 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.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \cos y - z \cdot \sin y \end{array} \]
(FPCore (x y z) :precision binary64 (- (* x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
	return (x * cos(y)) - (z * sin(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 * cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
	return (x * Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z):
	return (x * math.cos(y)) - (z * math.sin(y))
function code(x, y, z)
	return Float64(Float64(x * cos(y)) - Float64(z * sin(y)))
end
function tmp = code(x, y, z)
	tmp = (x * cos(y)) - (z * sin(y));
end
code[x_, y_, z_] := N[(N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \cos y - z \cdot \sin y
\end{array}

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

      \[\leadsto \color{blue}{x \cdot \cos y - z \cdot \sin y} \]
    2. sub-negN/A

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 1.0× speedup?

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

\\
\cos y \cdot x - z \cdot \sin y
\end{array}
Derivation
  1. Initial program 99.8%

    \[x \cdot \cos y - z \cdot \sin y \]
  2. Add Preprocessing
  3. Final simplification99.8%

    \[\leadsto \cos y \cdot x - z \cdot \sin y \]
  4. Add Preprocessing

Alternative 3: 86.2% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{-124}:\\ \;\;\;\;\mathsf{fma}\left(\sin y, -z, x \cdot 1\right)\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-130}:\\ \;\;\;\;\cos y \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1 - z \cdot \sin y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -5.2e-124)
   (fma (sin y) (- z) (* x 1.0))
   (if (<= z 1.45e-130) (* (cos y) x) (- (* x 1.0) (* z (sin y))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -5.2e-124) {
		tmp = fma(sin(y), -z, (x * 1.0));
	} else if (z <= 1.45e-130) {
		tmp = cos(y) * x;
	} else {
		tmp = (x * 1.0) - (z * sin(y));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (z <= -5.2e-124)
		tmp = fma(sin(y), Float64(-z), Float64(x * 1.0));
	elseif (z <= 1.45e-130)
		tmp = Float64(cos(y) * x);
	else
		tmp = Float64(Float64(x * 1.0) - Float64(z * sin(y)));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[z, -5.2e-124], N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x * 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e-130], N[(N[Cos[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(x * 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-124}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, x \cdot 1\right)\\

\mathbf{elif}\;z \leq 1.45 \cdot 10^{-130}:\\
\;\;\;\;\cos y \cdot x\\

\mathbf{else}:\\
\;\;\;\;x \cdot 1 - z \cdot \sin y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.1999999999999999e-124

    1. Initial program 99.8%

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

        \[\leadsto \color{blue}{x \cdot \cos y - z \cdot \sin y} \]
      2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

      if -5.1999999999999999e-124 < z < 1.45e-130

      1. Initial program 99.8%

        \[x \cdot \cos y - z \cdot \sin y \]
      2. Add Preprocessing
      3. Taylor expanded in x around inf

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

          \[\leadsto \color{blue}{x \cdot \cos y} \]
        2. lower-cos.f6493.2

          \[\leadsto x \cdot \color{blue}{\cos y} \]
      5. Applied rewrites93.2%

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

      if 1.45e-130 < z

      1. Initial program 99.8%

        \[x \cdot \cos y - z \cdot \sin y \]
      2. Add Preprocessing
      3. Taylor expanded in y around 0

        \[\leadsto x \cdot \color{blue}{1} - z \cdot \sin y \]
      4. Step-by-step derivation
        1. Applied rewrites89.0%

          \[\leadsto x \cdot \color{blue}{1} - z \cdot \sin y \]
      5. Recombined 3 regimes into one program.
      6. Final simplification89.8%

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

      Alternative 4: 86.2% accurate, 1.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot 1 - z \cdot \sin y\\ \mathbf{if}\;z \leq -5.2 \cdot 10^{-124}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-130}:\\ \;\;\;\;\cos y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (- (* x 1.0) (* z (sin y)))))
         (if (<= z -5.2e-124) t_0 (if (<= z 1.45e-130) (* (cos y) x) t_0))))
      double code(double x, double y, double z) {
      	double t_0 = (x * 1.0) - (z * sin(y));
      	double tmp;
      	if (z <= -5.2e-124) {
      		tmp = t_0;
      	} else if (z <= 1.45e-130) {
      		tmp = cos(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 = (x * 1.0d0) - (z * sin(y))
          if (z <= (-5.2d-124)) then
              tmp = t_0
          else if (z <= 1.45d-130) then
              tmp = cos(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 = (x * 1.0) - (z * Math.sin(y));
      	double tmp;
      	if (z <= -5.2e-124) {
      		tmp = t_0;
      	} else if (z <= 1.45e-130) {
      		tmp = Math.cos(y) * x;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = (x * 1.0) - (z * math.sin(y))
      	tmp = 0
      	if z <= -5.2e-124:
      		tmp = t_0
      	elif z <= 1.45e-130:
      		tmp = math.cos(y) * x
      	else:
      		tmp = t_0
      	return tmp
      
      function code(x, y, z)
      	t_0 = Float64(Float64(x * 1.0) - Float64(z * sin(y)))
      	tmp = 0.0
      	if (z <= -5.2e-124)
      		tmp = t_0;
      	elseif (z <= 1.45e-130)
      		tmp = Float64(cos(y) * x);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = (x * 1.0) - (z * sin(y));
      	tmp = 0.0;
      	if (z <= -5.2e-124)
      		tmp = t_0;
      	elseif (z <= 1.45e-130)
      		tmp = cos(y) * x;
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.2e-124], t$95$0, If[LessEqual[z, 1.45e-130], N[(N[Cos[y], $MachinePrecision] * x), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := x \cdot 1 - z \cdot \sin y\\
      \mathbf{if}\;z \leq -5.2 \cdot 10^{-124}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;z \leq 1.45 \cdot 10^{-130}:\\
      \;\;\;\;\cos y \cdot x\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if z < -5.1999999999999999e-124 or 1.45e-130 < z

        1. Initial program 99.8%

          \[x \cdot \cos y - z \cdot \sin y \]
        2. Add Preprocessing
        3. Taylor expanded in y around 0

          \[\leadsto x \cdot \color{blue}{1} - z \cdot \sin y \]
        4. Step-by-step derivation
          1. Applied rewrites88.4%

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

          if -5.1999999999999999e-124 < z < 1.45e-130

          1. Initial program 99.8%

            \[x \cdot \cos y - z \cdot \sin y \]
          2. Add Preprocessing
          3. Taylor expanded in x around inf

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

              \[\leadsto \color{blue}{x \cdot \cos y} \]
            2. lower-cos.f6493.2

              \[\leadsto x \cdot \color{blue}{\cos y} \]
          5. Applied rewrites93.2%

            \[\leadsto \color{blue}{x \cdot \cos y} \]
        5. Recombined 2 regimes into one program.
        6. Final simplification89.8%

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{-124}:\\ \;\;\;\;x \cdot 1 - z \cdot \sin y\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{-130}:\\ \;\;\;\;\cos y \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot 1 - z \cdot \sin y\\ \end{array} \]
        7. Add Preprocessing

        Alternative 5: 74.1% accurate, 1.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos y \cdot x\\ \mathbf{if}\;y \leq -3 \cdot 10^{+116}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -27000000000:\\ \;\;\;\;\sin y \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(y \cdot \left(y \cdot y\right), \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), y\right), -z, x \cdot 1\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (let* ((t_0 (* (cos y) x)))
           (if (<= y -3e+116)
             t_0
             (if (<= y -27000000000.0)
               (* (sin y) (- z))
               (if (<= y 3.3e-7)
                 (fma
                  (fma
                   (* y (* y y))
                   (fma
                    (* y y)
                    (fma (* y y) -0.0001984126984126984 0.008333333333333333)
                    -0.16666666666666666)
                   y)
                  (- z)
                  (* x 1.0))
                 t_0)))))
        double code(double x, double y, double z) {
        	double t_0 = cos(y) * x;
        	double tmp;
        	if (y <= -3e+116) {
        		tmp = t_0;
        	} else if (y <= -27000000000.0) {
        		tmp = sin(y) * -z;
        	} else if (y <= 3.3e-7) {
        		tmp = fma(fma((y * (y * y)), fma((y * y), fma((y * y), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666), y), -z, (x * 1.0));
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        function code(x, y, z)
        	t_0 = Float64(cos(y) * x)
        	tmp = 0.0
        	if (y <= -3e+116)
        		tmp = t_0;
        	elseif (y <= -27000000000.0)
        		tmp = Float64(sin(y) * Float64(-z));
        	elseif (y <= 3.3e-7)
        		tmp = fma(fma(Float64(y * Float64(y * y)), fma(Float64(y * y), fma(Float64(y * y), -0.0001984126984126984, 0.008333333333333333), -0.16666666666666666), y), Float64(-z), Float64(x * 1.0));
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -3e+116], t$95$0, If[LessEqual[y, -27000000000.0], N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[y, 3.3e-7], N[(N[(N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + y), $MachinePrecision] * (-z) + N[(x * 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \cos y \cdot x\\
        \mathbf{if}\;y \leq -3 \cdot 10^{+116}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;y \leq -27000000000:\\
        \;\;\;\;\sin y \cdot \left(-z\right)\\
        
        \mathbf{elif}\;y \leq 3.3 \cdot 10^{-7}:\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(y \cdot \left(y \cdot y\right), \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), y\right), -z, x \cdot 1\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y < -2.9999999999999999e116 or 3.3000000000000002e-7 < y

          1. Initial program 99.6%

            \[x \cdot \cos y - z \cdot \sin y \]
          2. Add Preprocessing
          3. Taylor expanded in x around inf

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

              \[\leadsto \color{blue}{x \cdot \cos y} \]
            2. lower-cos.f6455.8

              \[\leadsto x \cdot \color{blue}{\cos y} \]
          5. Applied rewrites55.8%

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

          if -2.9999999999999999e116 < y < -2.7e10

          1. Initial program 99.7%

            \[x \cdot \cos y - z \cdot \sin y \]
          2. Add Preprocessing
          3. Taylor expanded in x around 0

            \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \sin y\right)} \]
          4. Step-by-step derivation
            1. mul-1-negN/A

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

              \[\leadsto \color{blue}{\mathsf{neg}\left(z \cdot \sin y\right)} \]
            3. lower-*.f64N/A

              \[\leadsto \mathsf{neg}\left(\color{blue}{z \cdot \sin y}\right) \]
            4. lower-sin.f6478.7

              \[\leadsto -z \cdot \color{blue}{\sin y} \]
          5. Applied rewrites78.7%

            \[\leadsto \color{blue}{-z \cdot \sin y} \]

          if -2.7e10 < y < 3.3000000000000002e-7

          1. Initial program 100.0%

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

              \[\leadsto \color{blue}{x \cdot \cos y - z \cdot \sin y} \]
            2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{y \cdot \left(1 + {y}^{2} \cdot \left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}\right)\right)}, \mathsf{neg}\left(z\right), x \cdot 1\right) \]
            3. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \mathsf{fma}\left(y \cdot \color{blue}{\left({y}^{2} \cdot \left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}\right) + 1\right)}, \mathsf{neg}\left(z\right), x \cdot 1\right) \]
              2. distribute-lft-inN/A

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

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

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

                \[\leadsto \mathsf{fma}\left(\color{blue}{{y}^{3}} \cdot \left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}\right) + y \cdot 1, \mathsf{neg}\left(z\right), x \cdot 1\right) \]
              6. *-rgt-identityN/A

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

                \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left({y}^{3}, {y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}, y\right)}, \mathsf{neg}\left(z\right), x \cdot 1\right) \]
            4. Applied rewrites98.8%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3 \cdot 10^{+116}:\\ \;\;\;\;\cos y \cdot x\\ \mathbf{elif}\;y \leq -27000000000:\\ \;\;\;\;\sin y \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(y \cdot \left(y \cdot y\right), \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), y\right), -z, x \cdot 1\right)\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot x\\ \end{array} \]
          9. Add Preprocessing

          Alternative 6: 74.3% accurate, 1.8× speedup?

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

            1. Initial program 99.6%

              \[x \cdot \cos y - z \cdot \sin y \]
            2. Add Preprocessing
            3. Taylor expanded in x around inf

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

                \[\leadsto \color{blue}{x \cdot \cos y} \]
              2. lower-cos.f6450.0

                \[\leadsto x \cdot \color{blue}{\cos y} \]
            5. Applied rewrites50.0%

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

            if -1.5 < y < 3.3000000000000002e-7

            1. Initial program 100.0%

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

                \[\leadsto \color{blue}{x \cdot \cos y - z \cdot \sin y} \]
              2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\color{blue}{y \cdot \left(1 + {y}^{2} \cdot \left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}\right)\right)}, \mathsf{neg}\left(z\right), x \cdot 1\right) \]
              3. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(y \cdot \color{blue}{\left({y}^{2} \cdot \left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}\right) + 1\right)}, \mathsf{neg}\left(z\right), x \cdot 1\right) \]
                2. distribute-lft-inN/A

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

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

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

                  \[\leadsto \mathsf{fma}\left(\color{blue}{{y}^{3}} \cdot \left({y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}\right) + y \cdot 1, \mathsf{neg}\left(z\right), x \cdot 1\right) \]
                6. *-rgt-identityN/A

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

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left({y}^{3}, {y}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {y}^{2}\right) - \frac{1}{6}, y\right)}, \mathsf{neg}\left(z\right), x \cdot 1\right) \]
              4. Applied rewrites100.0%

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.5:\\ \;\;\;\;\cos y \cdot x\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(y \cdot \left(y \cdot y\right), \mathsf{fma}\left(y \cdot y, \mathsf{fma}\left(y \cdot y, -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), y\right), -z, x \cdot 1\right)\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot x\\ \end{array} \]
            9. Add Preprocessing

            Alternative 7: 40.9% accurate, 10.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(-z\right)\\ \mathbf{if}\;z \leq -2.8 \cdot 10^{+237}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 2 \cdot 10^{+217}:\\ \;\;\;\;x \cdot 1\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (let* ((t_0 (* y (- z))))
               (if (<= z -2.8e+237) t_0 (if (<= z 2e+217) (* x 1.0) t_0))))
            double code(double x, double y, double z) {
            	double t_0 = y * -z;
            	double tmp;
            	if (z <= -2.8e+237) {
            		tmp = t_0;
            	} else if (z <= 2e+217) {
            		tmp = x * 1.0;
            	} 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 = y * -z
                if (z <= (-2.8d+237)) then
                    tmp = t_0
                else if (z <= 2d+217) then
                    tmp = x * 1.0d0
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = y * -z;
            	double tmp;
            	if (z <= -2.8e+237) {
            		tmp = t_0;
            	} else if (z <= 2e+217) {
            		tmp = x * 1.0;
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = y * -z
            	tmp = 0
            	if z <= -2.8e+237:
            		tmp = t_0
            	elif z <= 2e+217:
            		tmp = x * 1.0
            	else:
            		tmp = t_0
            	return tmp
            
            function code(x, y, z)
            	t_0 = Float64(y * Float64(-z))
            	tmp = 0.0
            	if (z <= -2.8e+237)
            		tmp = t_0;
            	elseif (z <= 2e+217)
            		tmp = Float64(x * 1.0);
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = y * -z;
            	tmp = 0.0;
            	if (z <= -2.8e+237)
            		tmp = t_0;
            	elseif (z <= 2e+217)
            		tmp = x * 1.0;
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := Block[{t$95$0 = N[(y * (-z)), $MachinePrecision]}, If[LessEqual[z, -2.8e+237], t$95$0, If[LessEqual[z, 2e+217], N[(x * 1.0), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := y \cdot \left(-z\right)\\
            \mathbf{if}\;z \leq -2.8 \cdot 10^{+237}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;z \leq 2 \cdot 10^{+217}:\\
            \;\;\;\;x \cdot 1\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z < -2.79999999999999983e237 or 1.99999999999999992e217 < z

              1. Initial program 99.9%

                \[x \cdot \cos y - z \cdot \sin y \]
              2. Add Preprocessing
              3. Taylor expanded in y around 0

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

                  \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(y \cdot z\right)\right)} \]
                2. unsub-negN/A

                  \[\leadsto \color{blue}{x - y \cdot z} \]
                3. lower--.f64N/A

                  \[\leadsto \color{blue}{x - y \cdot z} \]
                4. *-commutativeN/A

                  \[\leadsto x - \color{blue}{z \cdot y} \]
                5. lower-*.f6465.8

                  \[\leadsto x - \color{blue}{z \cdot y} \]
              5. Applied rewrites65.8%

                \[\leadsto \color{blue}{x - z \cdot y} \]
              6. Taylor expanded in x around 0

                \[\leadsto -1 \cdot \color{blue}{\left(y \cdot z\right)} \]
              7. Step-by-step derivation
                1. Applied rewrites50.8%

                  \[\leadsto y \cdot \color{blue}{\left(-z\right)} \]

                if -2.79999999999999983e237 < z < 1.99999999999999992e217

                1. Initial program 99.8%

                  \[x \cdot \cos y - z \cdot \sin y \]
                2. Add Preprocessing
                3. Taylor expanded in x around inf

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

                    \[\leadsto \color{blue}{x \cdot \cos y} \]
                  2. lower-cos.f6468.1

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

                  \[\leadsto \color{blue}{x \cdot \cos y} \]
                6. Taylor expanded in y around 0

                  \[\leadsto x \cdot 1 \]
                7. Step-by-step derivation
                  1. Applied rewrites44.2%

                    \[\leadsto x \cdot 1 \]
                8. Recombined 2 regimes into one program.
                9. Add Preprocessing

                Alternative 8: 52.0% accurate, 23.8× speedup?

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

                  \[x \cdot \cos y - z \cdot \sin y \]
                2. Add Preprocessing
                3. Taylor expanded in y around 0

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

                    \[\leadsto x + \color{blue}{\left(\mathsf{neg}\left(y \cdot z\right)\right)} \]
                  2. unsub-negN/A

                    \[\leadsto \color{blue}{x - y \cdot z} \]
                  3. lower--.f64N/A

                    \[\leadsto \color{blue}{x - y \cdot z} \]
                  4. *-commutativeN/A

                    \[\leadsto x - \color{blue}{z \cdot y} \]
                  5. lower-*.f6453.7

                    \[\leadsto x - \color{blue}{z \cdot y} \]
                5. Applied rewrites53.7%

                  \[\leadsto \color{blue}{x - z \cdot y} \]
                6. Final simplification53.7%

                  \[\leadsto x - y \cdot z \]
                7. Add Preprocessing

                Alternative 9: 38.8% accurate, 35.7× speedup?

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

                  \[x \cdot \cos y - z \cdot \sin y \]
                2. Add Preprocessing
                3. Taylor expanded in x around inf

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

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

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

                  \[\leadsto \color{blue}{x \cdot \cos y} \]
                6. Taylor expanded in y around 0

                  \[\leadsto x \cdot 1 \]
                7. Step-by-step derivation
                  1. Applied rewrites40.2%

                    \[\leadsto x \cdot 1 \]
                  2. Add Preprocessing

                  Reproduce

                  ?
                  herbie shell --seed 2024223 
                  (FPCore (x y z)
                    :name "Diagrams.ThreeD.Transform:aboutX from diagrams-lib-1.3.0.3, A"
                    :precision binary64
                    (- (* x (cos y)) (* z (sin y))))