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

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} \\ 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}
Derivation
  1. Initial program 99.8%

    \[x \cdot \cos y - z \cdot \sin y \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 85.9% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{-122} \lor \neg \left(z \leq 2.15 \cdot 10^{-8}\right):\\ \;\;\;\;x \cdot 1 - z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -1.25e-122) (not (<= z 2.15e-8)))
   (- (* x 1.0) (* z (sin y)))
   (* (cos y) x)))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.25e-122) || !(z <= 2.15e-8)) {
		tmp = (x * 1.0) - (z * sin(y));
	} else {
		tmp = cos(y) * x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((z <= (-1.25d-122)) .or. (.not. (z <= 2.15d-8))) then
        tmp = (x * 1.0d0) - (z * sin(y))
    else
        tmp = cos(y) * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -1.25e-122) || !(z <= 2.15e-8)) {
		tmp = (x * 1.0) - (z * Math.sin(y));
	} else {
		tmp = Math.cos(y) * x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -1.25e-122) or not (z <= 2.15e-8):
		tmp = (x * 1.0) - (z * math.sin(y))
	else:
		tmp = math.cos(y) * x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -1.25e-122) || !(z <= 2.15e-8))
		tmp = Float64(Float64(x * 1.0) - Float64(z * sin(y)));
	else
		tmp = Float64(cos(y) * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -1.25e-122) || ~((z <= 2.15e-8)))
		tmp = (x * 1.0) - (z * sin(y));
	else
		tmp = cos(y) * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.25e-122], N[Not[LessEqual[z, 2.15e-8]], $MachinePrecision]], N[(N[(x * 1.0), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-122} \lor \neg \left(z \leq 2.15 \cdot 10^{-8}\right):\\
\;\;\;\;x \cdot 1 - z \cdot \sin y\\

\mathbf{else}:\\
\;\;\;\;\cos y \cdot x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.25e-122 or 2.1500000000000001e-8 < 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 x \cdot \color{blue}{1} - z \cdot \sin y \]
    4. Step-by-step derivation
      1. Applied rewrites89.7%

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

      if -1.25e-122 < z < 2.1500000000000001e-8

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

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

          \[\leadsto \mathsf{fma}\left(\sin y, -z, \color{blue}{\cos y \cdot x}\right) \]
        11. 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 x around inf

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos y \cdot x \]
      9. Step-by-step derivation
        1. Applied rewrites88.3%

          \[\leadsto \cos y \cdot x \]
      10. Recombined 2 regimes into one program.
      11. Final simplification89.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{-122} \lor \neg \left(z \leq 2.15 \cdot 10^{-8}\right):\\ \;\;\;\;x \cdot 1 - z \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot x\\ \end{array} \]
      12. Add Preprocessing

      Alternative 3: 85.9% accurate, 1.7× speedup?

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

        1. Initial program 99.9%

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

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

          if -1.25e-122 < z < 2.1500000000000001e-8

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

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

              \[\leadsto \mathsf{fma}\left(\sin y, -z, \color{blue}{\cos y \cdot x}\right) \]
            11. 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 x around inf

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \cos y \cdot x \]
          9. Step-by-step derivation
            1. Applied rewrites88.3%

              \[\leadsto \cos y \cdot x \]

            if 2.1500000000000001e-8 < 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.1%

                \[\leadsto x \cdot \color{blue}{1} - z \cdot \sin y \]
              2. Step-by-step derivation
                1. lift--.f64N/A

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

                  \[\leadsto x \cdot 1 - \color{blue}{z \cdot \sin y} \]
                3. cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(\sin y, -z, 1 \cdot x\right)} \]
            5. Recombined 3 regimes into one program.
            6. Final simplification89.1%

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

            Alternative 4: 74.2% accurate, 1.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{+60} \lor \neg \left(z \leq 2.6 \cdot 10^{+130}\right):\\ \;\;\;\;\left(-z\right) \cdot \sin y\\ \mathbf{else}:\\ \;\;\;\;\cos y \cdot x\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (or (<= z -5e+60) (not (<= z 2.6e+130))) (* (- z) (sin y)) (* (cos y) x)))
            double code(double x, double y, double z) {
            	double tmp;
            	if ((z <= -5e+60) || !(z <= 2.6e+130)) {
            		tmp = -z * sin(y);
            	} else {
            		tmp = cos(y) * x;
            	}
            	return tmp;
            }
            
            real(8) function code(x, y, z)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8) :: tmp
                if ((z <= (-5d+60)) .or. (.not. (z <= 2.6d+130))) then
                    tmp = -z * sin(y)
                else
                    tmp = cos(y) * x
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double tmp;
            	if ((z <= -5e+60) || !(z <= 2.6e+130)) {
            		tmp = -z * Math.sin(y);
            	} else {
            		tmp = Math.cos(y) * x;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	tmp = 0
            	if (z <= -5e+60) or not (z <= 2.6e+130):
            		tmp = -z * math.sin(y)
            	else:
            		tmp = math.cos(y) * x
            	return tmp
            
            function code(x, y, z)
            	tmp = 0.0
            	if ((z <= -5e+60) || !(z <= 2.6e+130))
            		tmp = Float64(Float64(-z) * sin(y));
            	else
            		tmp = Float64(cos(y) * x);
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	tmp = 0.0;
            	if ((z <= -5e+60) || ~((z <= 2.6e+130)))
            		tmp = -z * sin(y);
            	else
            		tmp = cos(y) * x;
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, y_, z_] := If[Or[LessEqual[z, -5e+60], N[Not[LessEqual[z, 2.6e+130]], $MachinePrecision]], N[((-z) * N[Sin[y], $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] * x), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;z \leq -5 \cdot 10^{+60} \lor \neg \left(z \leq 2.6 \cdot 10^{+130}\right):\\
            \;\;\;\;\left(-z\right) \cdot \sin y\\
            
            \mathbf{else}:\\
            \;\;\;\;\cos y \cdot x\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if z < -4.99999999999999975e60 or 2.5999999999999998e130 < z

              1. Initial program 99.8%

                \[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. distribute-lft-neg-inN/A

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

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

                  \[\leadsto \color{blue}{\left(-z\right)} \cdot \sin y \]
                5. lower-sin.f6477.7

                  \[\leadsto \left(-z\right) \cdot \color{blue}{\sin y} \]
              5. Applied rewrites77.7%

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

              if -4.99999999999999975e60 < z < 2.5999999999999998e130

              1. Initial program 99.9%

                \[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.9

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\left(\cos y + \frac{\left(-1 \cdot \frac{{z}^{2} \cdot {\sin y}^{2}}{x \cdot \cos y} + \frac{{z}^{2} \cdot {\sin y}^{2}}{x \cdot \cos y}\right) - z \cdot \sin y}{x}\right) \cdot x} \]
              7. Applied rewrites98.6%

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

                \[\leadsto \cos y \cdot x \]
              9. Step-by-step derivation
                1. Applied rewrites80.5%

                  \[\leadsto \cos y \cdot x \]
              10. Recombined 2 regimes into one program.
              11. Final simplification79.5%

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

              Alternative 5: 74.3% accurate, 1.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.058 \lor \neg \left(y \leq 0.07\right):\\ \;\;\;\;\cos y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, z \cdot y, -0.5 \cdot x\right) \cdot y - z, y, x\right)\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (or (<= y -0.058) (not (<= y 0.07)))
                 (* (cos y) x)
                 (fma (- (* (fma 0.16666666666666666 (* z y) (* -0.5 x)) y) z) y x)))
              double code(double x, double y, double z) {
              	double tmp;
              	if ((y <= -0.058) || !(y <= 0.07)) {
              		tmp = cos(y) * x;
              	} else {
              		tmp = fma(((fma(0.16666666666666666, (z * y), (-0.5 * x)) * y) - z), y, x);
              	}
              	return tmp;
              }
              
              function code(x, y, z)
              	tmp = 0.0
              	if ((y <= -0.058) || !(y <= 0.07))
              		tmp = Float64(cos(y) * x);
              	else
              		tmp = fma(Float64(Float64(fma(0.16666666666666666, Float64(z * y), Float64(-0.5 * x)) * y) - z), y, x);
              	end
              	return tmp
              end
              
              code[x_, y_, z_] := If[Or[LessEqual[y, -0.058], N[Not[LessEqual[y, 0.07]], $MachinePrecision]], N[(N[Cos[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * N[(z * y), $MachinePrecision] + N[(-0.5 * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] - z), $MachinePrecision] * y + x), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;y \leq -0.058 \lor \neg \left(y \leq 0.07\right):\\
              \;\;\;\;\cos y \cdot x\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, z \cdot y, -0.5 \cdot x\right) \cdot y - z, y, x\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if y < -0.0580000000000000029 or 0.070000000000000007 < 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. 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.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \cos y \cdot x \]
                9. Step-by-step derivation
                  1. Applied rewrites50.5%

                    \[\leadsto \cos y \cdot x \]

                  if -0.0580000000000000029 < y < 0.070000000000000007

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{6}, \color{blue}{z \cdot y}, \frac{-1}{2} \cdot x\right) \cdot y - z, y, x\right) \]
                    11. lower-*.f6499.7

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, z \cdot y, -0.5 \cdot x\right) \cdot y - z, y, x\right)} \]
                10. Recombined 2 regimes into one program.
                11. Final simplification74.7%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.058 \lor \neg \left(y \leq 0.07\right):\\ \;\;\;\;\cos y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, z \cdot y, -0.5 \cdot x\right) \cdot y - z, y, x\right)\\ \end{array} \]
                12. Add Preprocessing

                Alternative 6: 41.7% accurate, 10.7× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{-191} \lor \neg \left(x \leq 3.8 \cdot 10^{-155}\right):\\ \;\;\;\;1 \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(-y\right) \cdot z\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (if (or (<= x -2e-191) (not (<= x 3.8e-155))) (* 1.0 x) (* (- y) z)))
                double code(double x, double y, double z) {
                	double tmp;
                	if ((x <= -2e-191) || !(x <= 3.8e-155)) {
                		tmp = 1.0 * x;
                	} else {
                		tmp = -y * z;
                	}
                	return tmp;
                }
                
                real(8) function code(x, y, z)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8), intent (in) :: z
                    real(8) :: tmp
                    if ((x <= (-2d-191)) .or. (.not. (x <= 3.8d-155))) then
                        tmp = 1.0d0 * x
                    else
                        tmp = -y * z
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y, double z) {
                	double tmp;
                	if ((x <= -2e-191) || !(x <= 3.8e-155)) {
                		tmp = 1.0 * x;
                	} else {
                		tmp = -y * z;
                	}
                	return tmp;
                }
                
                def code(x, y, z):
                	tmp = 0
                	if (x <= -2e-191) or not (x <= 3.8e-155):
                		tmp = 1.0 * x
                	else:
                		tmp = -y * z
                	return tmp
                
                function code(x, y, z)
                	tmp = 0.0
                	if ((x <= -2e-191) || !(x <= 3.8e-155))
                		tmp = Float64(1.0 * x);
                	else
                		tmp = Float64(Float64(-y) * z);
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y, z)
                	tmp = 0.0;
                	if ((x <= -2e-191) || ~((x <= 3.8e-155)))
                		tmp = 1.0 * x;
                	else
                		tmp = -y * z;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_, z_] := If[Or[LessEqual[x, -2e-191], N[Not[LessEqual[x, 3.8e-155]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[((-y) * z), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;x \leq -2 \cdot 10^{-191} \lor \neg \left(x \leq 3.8 \cdot 10^{-155}\right):\\
                \;\;\;\;1 \cdot x\\
                
                \mathbf{else}:\\
                \;\;\;\;\left(-y\right) \cdot z\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if x < -2e-191 or 3.7999999999999998e-155 < x

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

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

                      \[\leadsto \mathsf{fma}\left(\sin y, -z, \color{blue}{\cos y \cdot x}\right) \]
                    11. 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 x around inf

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto 1 \cdot x \]

                    if -2e-191 < x < 3.7999999999999998e-155

                    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-*.f6464.5

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

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

                        \[\leadsto \left(-y\right) \cdot \color{blue}{z} \]
                    8. Recombined 2 regimes into one program.
                    9. Final simplification45.2%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{-191} \lor \neg \left(x \leq 3.8 \cdot 10^{-155}\right):\\ \;\;\;\;1 \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(-y\right) \cdot z\\ \end{array} \]
                    10. Add Preprocessing

                    Alternative 7: 51.7% accurate, 23.8× speedup?

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

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

                      \[\leadsto \color{blue}{x - z \cdot y} \]
                    6. Add Preprocessing

                    Alternative 8: 38.5% accurate, 35.7× speedup?

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

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

                        \[\leadsto \mathsf{fma}\left(\sin y, -z, \color{blue}{\cos y \cdot x}\right) \]
                      11. 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 x around inf

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\left(\cos y + \frac{\left(-1 \cdot \frac{{z}^{2} \cdot {\sin y}^{2}}{x \cdot \cos y} + \frac{{z}^{2} \cdot {\sin y}^{2}}{x \cdot \cos y}\right) - z \cdot \sin y}{x}\right) \cdot x} \]
                    7. Applied rewrites91.3%

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

                      \[\leadsto 1 \cdot x \]
                    9. Step-by-step derivation
                      1. Applied rewrites39.3%

                        \[\leadsto 1 \cdot x \]
                      2. Final simplification39.3%

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

                      Reproduce

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