?

Average Error: 0.2% → 0.19%
Time: 12.0s
Precision: binary64
Cost: 32896

?

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

Error?

Derivation?

  1. Initial program 0.2

    \[x \cdot \cos y - z \cdot \sin y \]
  2. Applied egg-rr0.19

    \[\leadsto \color{blue}{z \cdot \left(-\sin y\right) + \left(x \cdot \cos y + \mathsf{fma}\left(-z, \sin y, z \cdot \sin y\right)\right)} \]
  3. Final simplification0.19

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

Alternatives

Alternative 1
Error0.2%
Cost13248
\[x \cdot \cos y - z \cdot \sin y \]
Alternative 2
Error25.34%
Cost7184
\[\begin{array}{l} t_0 := z \cdot \left(-\sin y\right)\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;y \leq -1.3 \cdot 10^{+176}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -0.135:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 0.0005:\\ \;\;\;\;x - z \cdot y\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+119}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error13.79%
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{+69} \lor \neg \left(x \leq 1.7 \cdot 10^{+66}\right):\\ \;\;\;\;x \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot \sin y\\ \end{array} \]
Alternative 4
Error25.73%
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -0.135 \lor \neg \left(y \leq 1.65 \cdot 10^{-9}\right):\\ \;\;\;\;x \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot y\\ \end{array} \]
Alternative 5
Error59.04%
Cost521
\[\begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{+174} \lor \neg \left(z \leq 4.3 \cdot 10^{+176}\right):\\ \;\;\;\;z \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error48.63%
Cost320
\[x - z \cdot y \]
Alternative 7
Error61.48%
Cost64
\[x \]

Error

Reproduce?

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