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

Percentage Accurate: 99.8% → 99.8%
Time: 7.7s
Alternatives: 8
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 8 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)} \]
    6. lift-*.f64N/A

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

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

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

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

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

Alternative 2: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 3: 73.7% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \cos y\\ \mathbf{if}\;y \leq -1.65 \cdot 10^{+171}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -0.84:\\ \;\;\;\;z \cdot \sin y\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-20}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x \cdot y, -0.5, z\right), 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 -1.65e+171)
     t_0
     (if (<= y -0.84)
       (* z (sin y))
       (if (<= y 8e-20) (fma (fma (* x y) -0.5 z) y x) t_0)))))
double code(double x, double y, double z) {
	double t_0 = x * cos(y);
	double tmp;
	if (y <= -1.65e+171) {
		tmp = t_0;
	} else if (y <= -0.84) {
		tmp = z * sin(y);
	} else if (y <= 8e-20) {
		tmp = fma(fma((x * y), -0.5, 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 <= -1.65e+171)
		tmp = t_0;
	elseif (y <= -0.84)
		tmp = Float64(z * sin(y));
	elseif (y <= 8e-20)
		tmp = fma(fma(Float64(x * y), -0.5, 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, -1.65e+171], t$95$0, If[LessEqual[y, -0.84], N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e-20], N[(N[(N[(x * y), $MachinePrecision] * -0.5 + z), $MachinePrecision] * y + x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \cos y\\
\mathbf{if}\;y \leq -1.65 \cdot 10^{+171}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq -0.84:\\
\;\;\;\;z \cdot \sin y\\

\mathbf{elif}\;y \leq 8 \cdot 10^{-20}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x \cdot y, -0.5, z\right), y, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.64999999999999996e171 or 7.99999999999999956e-20 < y

    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. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\left(x \cdot \cos y\right) \cdot \color{blue}{\left(\cos y \cdot x\right)}} + \sin y \cdot z \]
      12. associate-*r*N/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\sqrt{\color{blue}{\left(x \cdot \cos y\right) \cdot \cos y}}, \sqrt{x}, \sin y \cdot z\right) \]
      17. lower-sqrt.f6439.7

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(\cos y \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)} \]
    8. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(\cos y \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)} \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\cos y \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot x}\right) \]
      3. distribute-lft-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\cos y \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) \cdot x} \]
      4. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{{\left(\sqrt{-1}\right)}^{2} \cdot \cos y}\right)\right) \cdot x \]
      5. unpow2N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \cos y\right)\right) \cdot x \]
      6. rem-square-sqrtN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{-1} \cdot \cos y\right)\right) \cdot x \]
      7. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos y\right)\right)}\right)\right) \cdot x \]
      8. remove-double-negN/A

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

        \[\leadsto \color{blue}{\cos y \cdot x} \]
      10. lower-cos.f6464.4

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

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

    if -1.64999999999999996e171 < y < -0.839999999999999969

    1. Initial program 99.5%

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

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

        \[\leadsto \color{blue}{\sin y \cdot z} \]
      3. lower-sin.f6460.8

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

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

    if -0.839999999999999969 < y < 7.99999999999999956e-20

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.65 \cdot 10^{+171}:\\ \;\;\;\;x \cdot \cos y\\ \mathbf{elif}\;y \leq -0.84:\\ \;\;\;\;z \cdot \sin y\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-20}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x \cdot y, -0.5, z\right), y, x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \cos y\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 86.1% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\sin y, z, 1 \cdot x\right)\\
\mathbf{if}\;z \leq -7.8 \cdot 10^{-143}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.80000000000000007e-143 or 1.51999999999999999e-99 < z

    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)} \]
      6. lift-*.f64N/A

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

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

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

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

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

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

      if -7.80000000000000007e-143 < z < 1.51999999999999999e-99

      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. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \sqrt{\left(x \cdot \cos y\right) \cdot \color{blue}{\left(\cos y \cdot x\right)}} + \sin y \cdot z \]
        12. associate-*r*N/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\sqrt{\color{blue}{\left(x \cdot \cos y\right) \cdot \cos y}}, \sqrt{x}, \sin y \cdot z\right) \]
        17. lower-sqrt.f6438.2

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

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

          \[\leadsto \mathsf{fma}\left(\sqrt{\left(x \cdot \cos y\right) \cdot \cos y}, \sqrt{x}, \color{blue}{z \cdot \sin y}\right) \]
      6. Applied rewrites38.2%

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

        \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(\cos y \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)} \]
      8. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \color{blue}{\mathsf{neg}\left(x \cdot \left(\cos y \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right)} \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\cos y \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot x}\right) \]
        3. distribute-lft-neg-inN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\cos y \cdot {\left(\sqrt{-1}\right)}^{2}\right)\right) \cdot x} \]
        4. *-commutativeN/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{{\left(\sqrt{-1}\right)}^{2} \cdot \cos y}\right)\right) \cdot x \]
        5. unpow2N/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \cos y\right)\right) \cdot x \]
        6. rem-square-sqrtN/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{-1} \cdot \cos y\right)\right) \cdot x \]
        7. mul-1-negN/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\cos y\right)\right)}\right)\right) \cdot x \]
        8. remove-double-negN/A

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

          \[\leadsto \color{blue}{\cos y \cdot x} \]
        10. lower-cos.f6494.7

          \[\leadsto \color{blue}{\cos y} \cdot x \]
      9. Applied rewrites94.7%

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

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

    Alternative 5: 74.4% accurate, 1.8× speedup?

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

      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. *-commutativeN/A

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

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

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

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

      if -0.839999999999999969 < y < 8.59999999999999975e24

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

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

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

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

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

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

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

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

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

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

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

    Alternative 6: 52.1% 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.f6453.9

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

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

    Alternative 7: 16.9% accurate, 35.7× speedup?

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

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

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

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

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

      Alternative 8: 2.9% accurate, 214.0× speedup?

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

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

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

          \[\leadsto \frac{\color{blue}{\left(z \cdot \sin y\right) \cdot \left(z \cdot \sin y\right) - \left(x \cdot \cos y\right) \cdot \left(x \cdot \cos y\right)}}{z \cdot \sin y - x \cdot \cos y} \]
        6. pow2N/A

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{{\left(\sin y \cdot z\right)}^{2} - {\color{blue}{\left(\cos y \cdot x\right)}}^{2}}{z \cdot \sin y - x \cdot \cos y} \]
        16. lower--.f6457.2

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

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

          \[\leadsto \frac{{\left(\sin y \cdot z\right)}^{2} - {\left(\cos y \cdot x\right)}^{2}}{\color{blue}{\sin y \cdot z} - x \cdot \cos y} \]
        19. lower-*.f6457.2

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

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

          \[\leadsto \frac{{\left(\sin y \cdot z\right)}^{2} - {\left(\cos y \cdot x\right)}^{2}}{\sin y \cdot z - \color{blue}{\cos y \cdot x}} \]
        22. lower-*.f6457.2

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(y \cdot \left(-1 \cdot \frac{{z}^{2} - -1 \cdot {x}^{2}}{x} - \left(-1 \cdot \frac{{z}^{2}}{x} + \frac{-1}{2} \cdot x\right)\right) - -1 \cdot z, y, x\right)} \]
      7. Applied rewrites26.6%

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

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

          \[\leadsto 0 \]
        2. Add Preprocessing

        Reproduce

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