Average Error: 0.1 → 0.1
Time: 3.5s
Precision: 64
\[x \cdot \cos y + z \cdot \sin y\]
\[\frac{x \cdot \cos y - z \cdot \sin y}{\frac{x \cdot \cos y - z \cdot \sin y}{\mathsf{fma}\left(x, \cos y, \sin y \cdot z\right)}}\]
x \cdot \cos y + z \cdot \sin y
\frac{x \cdot \cos y - z \cdot \sin y}{\frac{x \cdot \cos y - z \cdot \sin y}{\mathsf{fma}\left(x, \cos y, \sin y \cdot z\right)}}
double code(double x, double y, double z) {
	return ((x * cos(y)) + (z * sin(y)));
}
double code(double x, double y, double z) {
	return (((x * cos(y)) - (z * sin(y))) / (((x * cos(y)) - (z * sin(y))) / fma(x, cos(y), (sin(y) * z))));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[x \cdot \cos y + z \cdot \sin y\]
  2. Using strategy rm
  3. Applied flip-+28.9

    \[\leadsto \color{blue}{\frac{\left(x \cdot \cos y\right) \cdot \left(x \cdot \cos y\right) - \left(z \cdot \sin y\right) \cdot \left(z \cdot \sin y\right)}{x \cdot \cos y - z \cdot \sin y}}\]
  4. Simplified28.9

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, \cos y, \sin y \cdot z\right) \cdot \left(x \cdot \cos y - z \cdot \sin y\right)}}{x \cdot \cos y - z \cdot \sin y}\]
  5. Using strategy rm
  6. Applied *-commutative28.9

    \[\leadsto \frac{\color{blue}{\left(x \cdot \cos y - z \cdot \sin y\right) \cdot \mathsf{fma}\left(x, \cos y, \sin y \cdot z\right)}}{x \cdot \cos y - z \cdot \sin y}\]
  7. Applied associate-/l*0.1

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

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

Reproduce

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