Average Error: 0.1 → 0.1
Time: 9.7s
Precision: binary64
\[x \cdot \cos y - z \cdot \sin y \]
\[\begin{array}{l} t_0 := \sin y \cdot z\\ \mathsf{fma}\left(x, \cos y, -t_0\right) + \mathsf{fma}\left(-\sin y, z, t_0\right) \end{array} \]
(FPCore (x y z) :precision binary64 (- (* x (cos y)) (* z (sin y))))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* (sin y) z)))
   (+ (fma x (cos y) (- t_0)) (fma (- (sin y)) z 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 = sin(y) * z;
	return fma(x, cos(y), -t_0) + fma(-sin(y), z, 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(sin(y) * z)
	return Float64(fma(x, cos(y), Float64(-t_0)) + fma(Float64(-sin(y)), z, 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[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]}, N[(N[(x * N[Cos[y], $MachinePrecision] + (-t$95$0)), $MachinePrecision] + N[((-N[Sin[y], $MachinePrecision]) * z + t$95$0), $MachinePrecision]), $MachinePrecision]]
x \cdot \cos y - z \cdot \sin y
\begin{array}{l}
t_0 := \sin y \cdot z\\
\mathsf{fma}\left(x, \cos y, -t_0\right) + \mathsf{fma}\left(-\sin y, z, t_0\right)
\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.1

    \[x \cdot \cos y - z \cdot \sin y \]
  2. Applied prod-diff_binary640.1

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

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

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

Reproduce

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