Average Error: 0.1 → 0.1
Time: 3.0s
Precision: binary64
Cost: 448
\[\frac{x \cdot x - 3}{6}\]
\[\frac{x \cdot x}{6} + -0.5\]
\frac{x \cdot x - 3}{6}
\frac{x \cdot x}{6} + -0.5
(FPCore (x) :precision binary64 (/ (- (* x x) 3.0) 6.0))
(FPCore (x) :precision binary64 (+ (/ (* x x) 6.0) -0.5))
double code(double x) {
	return ((x * x) - 3.0) / 6.0;
}
double code(double x) {
	return ((x * x) / 6.0) + -0.5;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error0.1
Cost448
\[\frac{x \cdot x - 3}{6}\]
Alternative 2
Error0.2
Cost448
\[\left(x \cdot x - 3\right) \cdot 0.16666666666666666\]
Alternative 3
Error1.1
Cost769
\[\begin{array}{l} \mathbf{if}\;x \cdot x \leq 3.0220778588967407:\\ \;\;\;\;-0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot x}{6}\\ \end{array}\]
Alternative 4
Error22.3
Cost64
\[-0.5\]
Alternative 5
Error55.9
Cost64
\[-1\]
Alternative 6
Error62.2
Cost64
\[0\]
Alternative 7
Error62.2
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.1

    \[\frac{x \cdot x - 3}{6}\]
  2. Using strategy rm
  3. Applied div-sub_binary64_28110.1

    \[\leadsto \color{blue}{\frac{x \cdot x}{6} - \frac{3}{6}}\]
  4. Simplified0.1

    \[\leadsto \frac{x \cdot x}{6} - \color{blue}{0.5}\]
  5. Simplified0.1

    \[\leadsto \color{blue}{\frac{x \cdot x}{6} + -0.5}\]
  6. Final simplification0.1

    \[\leadsto \frac{x \cdot x}{6} + -0.5\]

Reproduce

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