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

Error

Bits error versus x

Derivation

  1. Initial program 0.2

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

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, x, -3\right)}{6}} \]
  3. Applied clear-num_binary640.2

    \[\leadsto \color{blue}{\frac{1}{\frac{6}{\mathsf{fma}\left(x, x, -3\right)}}} \]
  4. Applied *-un-lft-identity_binary640.2

    \[\leadsto \frac{1}{\frac{6}{\color{blue}{1 \cdot \mathsf{fma}\left(x, x, -3\right)}}} \]
  5. Applied add-sqr-sqrt_binary641.0

    \[\leadsto \frac{1}{\frac{\color{blue}{\sqrt{6} \cdot \sqrt{6}}}{1 \cdot \mathsf{fma}\left(x, x, -3\right)}} \]
  6. Applied times-frac_binary641.1

    \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{6}}{1} \cdot \frac{\sqrt{6}}{\mathsf{fma}\left(x, x, -3\right)}}} \]
  7. Simplified1.1

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

    \[\leadsto \color{blue}{\frac{{x}^{2}}{{\left(\sqrt{6}\right)}^{2}} - 3 \cdot \frac{1}{{\left(\sqrt{6}\right)}^{2}}} \]
  9. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{6}, x, -0.5\right)} \]
  10. Final simplification0.1

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

Reproduce

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