Diagrams.ThreeD.Transform:aboutY from diagrams-lib-1.3.0.3

Percentage Accurate: 99.8% → 99.8%
Time: 11.4s
Alternatives: 7
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 7 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(\sin y, z, x \cdot \cos y\right) \end{array} \]
(FPCore (x y z) :precision binary64 (fma (sin y) z (* x (cos y))))
double code(double x, double y, double z) {
	return fma(sin(y), z, (x * cos(y)));
}
function code(x, y, z)
	return fma(sin(y), z, Float64(x * cos(y)))
end
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * z + N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\sin y, z, x \cdot \cos y\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. +-commutativeN/A

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

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

      \[\leadsto \color{blue}{\sin y \cdot z} + x \cdot \cos y \]
    5. lower-fma.f6499.8

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sin y, 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. Add Preprocessing

Alternative 2: 85.4% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \cos y\\
\mathbf{if}\;x \leq -0.0044:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.3 \cdot 10^{-26}:\\
\;\;\;\;x \cdot 1 + \sin y \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.00440000000000000027 or 1.30000000000000005e-26 < x

    1. Initial program 99.9%

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

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

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

    if -0.00440000000000000027 < x < 1.30000000000000005e-26

    1. Initial program 99.7%

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

        \[\leadsto x \cdot \color{blue}{1} + z \cdot \sin y \]
    5. Recombined 2 regimes into one program.
    6. Final simplification88.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.0044:\\ \;\;\;\;x \cdot \cos y\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{-26}:\\ \;\;\;\;x \cdot 1 + \sin y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \cos y\\ \end{array} \]
    7. Add Preprocessing

    Alternative 3: 85.4% accurate, 1.7× speedup?

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

      1. Initial program 99.9%

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

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

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

      if -0.00440000000000000027 < x < 1.30000000000000005e-26

      1. Initial program 99.7%

        \[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. +-commutativeN/A

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

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

          \[\leadsto \color{blue}{\sin y \cdot z} + x \cdot \cos y \]
        5. lower-fma.f6499.7

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

        \[\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, z, x \cdot \color{blue}{1}\right) \]
      6. Step-by-step derivation
        1. Applied rewrites86.8%

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

      Alternative 4: 74.5% accurate, 1.8× speedup?

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

        1. Initial program 99.9%

          \[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.f6488.4

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

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

        if -3.25e-52 < x < 1.15e-40

        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}{z \cdot \sin y} \]
        4. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \color{blue}{z \cdot \sin y} \]
          2. lower-sin.f6467.7

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

          \[\leadsto \color{blue}{z \cdot \sin y} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification79.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.25 \cdot 10^{-52}:\\ \;\;\;\;x \cdot \cos y\\ \mathbf{elif}\;x \leq 1.15 \cdot 10^{-40}:\\ \;\;\;\;\sin y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \cos y\\ \end{array} \]
      5. Add Preprocessing

      Alternative 5: 74.8% accurate, 1.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \cos y\\ \mathbf{if}\;y \leq -0.00041:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 5.7 \cdot 10^{-8}:\\ \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (* x (cos y))))
         (if (<= y -0.00041) t_0 (if (<= y 5.7e-8) (fma z y x) t_0))))
      double code(double x, double y, double z) {
      	double t_0 = x * cos(y);
      	double tmp;
      	if (y <= -0.00041) {
      		tmp = t_0;
      	} else if (y <= 5.7e-8) {
      		tmp = fma(z, y, x);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = Float64(x * cos(y))
      	tmp = 0.0
      	if (y <= -0.00041)
      		tmp = t_0;
      	elseif (y <= 5.7e-8)
      		tmp = fma(z, y, x);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.00041], t$95$0, If[LessEqual[y, 5.7e-8], N[(z * y + x), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := x \cdot \cos y\\
      \mathbf{if}\;y \leq -0.00041:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;y \leq 5.7 \cdot 10^{-8}:\\
      \;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -4.0999999999999999e-4 or 5.70000000000000009e-8 < 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.f6456.6

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

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

        if -4.0999999999999999e-4 < y < 5.70000000000000009e-8

        1. Initial program 100.0%

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

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

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

            \[\leadsto \color{blue}{z \cdot y} + x \]
          3. lower-fma.f64100.0

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

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

      Alternative 6: 52.2% accurate, 30.6× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(z, y, x\right) \end{array} \]
      (FPCore (x y z) :precision binary64 (fma z y x))
      double code(double x, double y, double z) {
      	return fma(z, y, x);
      }
      
      function code(x, y, z)
      	return fma(z, y, x)
      end
      
      code[x_, y_, z_] := N[(z * y + x), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(z, y, x\right)
      \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 + y \cdot z} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

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

          \[\leadsto \color{blue}{z \cdot y} + x \]
        3. lower-fma.f6442.3

          \[\leadsto \color{blue}{\mathsf{fma}\left(z, y, x\right)} \]
      5. Applied rewrites42.3%

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

      Alternative 7: 16.7% accurate, 35.7× speedup?

      \[\begin{array}{l} \\ y \cdot z \end{array} \]
      (FPCore (x y z) :precision binary64 (* y z))
      double code(double x, double y, double z) {
      	return 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 = y * z
      end function
      
      public static double code(double x, double y, double z) {
      	return y * z;
      }
      
      def code(x, y, z):
      	return y * z
      
      function code(x, y, z)
      	return Float64(y * z)
      end
      
      function tmp = code(x, y, z)
      	tmp = y * z;
      end
      
      code[x_, y_, z_] := N[(y * z), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      y \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 + y \cdot z} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

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

          \[\leadsto \color{blue}{z \cdot y} + x \]
        3. lower-fma.f6442.3

          \[\leadsto \color{blue}{\mathsf{fma}\left(z, y, x\right)} \]
      5. Applied rewrites42.3%

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

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

          \[\leadsto y \cdot \color{blue}{z} \]
        2. Add Preprocessing

        Reproduce

        ?
        herbie shell --seed 2024233 
        (FPCore (x y z)
          :name "Diagrams.ThreeD.Transform:aboutY from diagrams-lib-1.3.0.3"
          :precision binary64
          (+ (* x (cos y)) (* z (sin y))))