Average Error: 0.0 → 0.0
Time: 4.7s
Precision: binary64
\[\left(x + \sin y\right) + z \cdot \cos y \]
\[\sin y + \mathsf{fma}\left(\cos y, z, x\right) \]
\left(x + \sin y\right) + z \cdot \cos y
\sin y + \mathsf{fma}\left(\cos y, z, x\right)
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
(FPCore (x y z) :precision binary64 (+ (sin y) (fma (cos y) z x)))
double code(double x, double y, double z) {
	return (x + sin(y)) + (z * cos(y));
}
double code(double x, double y, double z) {
	return sin(y) + fma(cos(y), z, x);
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.0

    \[\left(x + \sin y\right) + z \cdot \cos y \]
  2. Taylor expanded in x around 0 0.0

    \[\leadsto \color{blue}{\sin y + \left(\cos y \cdot z + x\right)} \]
  3. Simplified0.0

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

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

Reproduce

herbie shell --seed 2022097 
(FPCore (x y z)
  :name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
  :precision binary64
  (+ (+ x (sin y)) (* z (cos y))))