?

Average Error: 0.1 → 0.1
Time: 13.6s
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.1

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

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

    \[\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.1
Cost13248
\[x \cdot \cos y - z \cdot \sin y \]
Alternative 2
Error15.7
Cost7581
\[\begin{array}{l} t_0 := \sin y \cdot \left(-z\right)\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;y \leq -2.8 \cdot 10^{+207}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{+181}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -8.2 \cdot 10^{-5}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1700:\\ \;\;\;\;x - z \cdot y\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+82} \lor \neg \left(y \leq 4 \cdot 10^{+133}\right) \land y \leq 6.1 \cdot 10^{+184}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error15.7
Cost7581
\[\begin{array}{l} t_0 := \sin y \cdot \left(-z\right)\\ t_1 := x \cdot \cos y\\ \mathbf{if}\;y \leq -6.4 \cdot 10^{+209}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7 \cdot 10^{+181}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -0.0003:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1700:\\ \;\;\;\;\mathsf{fma}\left(y, -z, x\right)\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+82} \lor \neg \left(y \leq 5.4 \cdot 10^{+133}\right) \land y \leq 2.25 \cdot 10^{+184}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error9.1
Cost6985
\[\begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+66} \lor \neg \left(x \leq 1.5 \cdot 10^{+112}\right):\\ \;\;\;\;x \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot \sin y\\ \end{array} \]
Alternative 5
Error16.4
Cost6857
\[\begin{array}{l} \mathbf{if}\;y \leq -68000 \lor \neg \left(y \leq 1700\right):\\ \;\;\;\;x \cdot \cos y\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot y\\ \end{array} \]
Alternative 6
Error37.8
Cost785
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{-151}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{-194} \lor \neg \left(x \leq 2.1 \cdot 10^{-135}\right) \land x \leq 1.3 \cdot 10^{-88}:\\ \;\;\;\;y \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error30.8
Cost320
\[x - z \cdot y \]
Alternative 8
Error39.0
Cost64
\[x \]

Error

Reproduce?

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