Average Error: 0.1 → 0.1
Time: 7.3s
Precision: binary64
\[\left(x + \cos y\right) - z \cdot \sin y \]
\[\mathsf{fma}\left(-\sin y, z, \cos y\right) + x \]
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
(FPCore (x y z) :precision binary64 (+ (fma (- (sin y)) z (cos y)) x))
double code(double x, double y, double z) {
	return (x + cos(y)) - (z * sin(y));
}
double code(double x, double y, double z) {
	return fma(-sin(y), z, cos(y)) + x;
}
function code(x, y, z)
	return Float64(Float64(x + cos(y)) - Float64(z * sin(y)))
end
function code(x, y, z)
	return Float64(fma(Float64(-sin(y)), z, cos(y)) + x)
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_] := N[(N[((-N[Sin[y], $MachinePrecision]) * z + N[Cos[y], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\left(x + \cos y\right) - z \cdot \sin y
\mathsf{fma}\left(-\sin y, z, \cos y\right) + x

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.1

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

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

    \[\leadsto \color{blue}{\left(\cos y - \sin y \cdot z\right) + x} \]
  4. Applied egg-rr0.1

    \[\leadsto \left(\color{blue}{\sqrt[3]{{\cos y}^{3}}} - \sin y \cdot z\right) + x \]
  5. Applied egg-rr0.1

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

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

Reproduce

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