Average Error: 0.2 → 0.1
Time: 1.5s
Precision: binary64
\[\frac{x \cdot x - 3}{6} \]
\[\mathsf{fma}\left(x, x \cdot 0.16666666666666666, -0.5\right) \]
(FPCore (x) :precision binary64 (/ (- (* x x) 3.0) 6.0))
(FPCore (x) :precision binary64 (fma x (* x 0.16666666666666666) -0.5))
double code(double x) {
	return ((x * x) - 3.0) / 6.0;
}
double code(double x) {
	return fma(x, (x * 0.16666666666666666), -0.5);
}
function code(x)
	return Float64(Float64(Float64(x * x) - 3.0) / 6.0)
end
function code(x)
	return fma(x, Float64(x * 0.16666666666666666), -0.5)
end
code[x_] := N[(N[(N[(x * x), $MachinePrecision] - 3.0), $MachinePrecision] / 6.0), $MachinePrecision]
code[x_] := N[(x * N[(x * 0.16666666666666666), $MachinePrecision] + -0.5), $MachinePrecision]
\frac{x \cdot x - 3}{6}
\mathsf{fma}\left(x, x \cdot 0.16666666666666666, -0.5\right)

Error

Bits error versus x

Derivation

  1. Initial program 0.2

    \[\frac{x \cdot x - 3}{6} \]
  2. Taylor expanded in x around 0 0.2

    \[\leadsto \color{blue}{0.16666666666666666 \cdot {x}^{2} - 0.5} \]
  3. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 0.16666666666666666 \cdot x, -0.5\right)} \]
  4. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(x, x \cdot 0.16666666666666666, -0.5\right) \]

Reproduce

herbie shell --seed 2022150 
(FPCore (x)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, H"
  :precision binary64
  (/ (- (* x x) 3.0) 6.0))