Average Error: 0.1 → 0.1
Time: 4.0s
Precision: binary64
\[\frac{x \cdot x - 3}{6} \]
\[\mathsf{fma}\left(0.16666666666666666, x \cdot x, -0.5\right) \]
\frac{x \cdot x - 3}{6}
\mathsf{fma}\left(0.16666666666666666, x \cdot x, -0.5\right)
(FPCore (x) :precision binary64 (/ (- (* x x) 3.0) 6.0))
(FPCore (x) :precision binary64 (fma 0.16666666666666666 (* x x) -0.5))
double code(double x) {
	return ((x * x) - 3.0) / 6.0;
}
double code(double x) {
	return fma(0.16666666666666666, (x * x), -0.5);
}

Error

Bits error versus x

Derivation

  1. Initial program 0.1

    \[\frac{x \cdot x - 3}{6} \]
  2. Simplified0.1

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, x, -3\right)}{6}} \]
  3. Taylor expanded in x around 0 0.1

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

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

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

Reproduce

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