Average Error: 30.0 → 0.0
Time: 5.1s
Precision: binary64
\[-0.01 \leq x \land x \leq 0.01\]
\[1 - \cos x \]
\[\left(0.001388888888888889 \cdot {x}^{6} + x \cdot \left(x \cdot 0.5\right)\right) - 0.041666666666666664 \cdot {x}^{4} \]
1 - \cos x
\left(0.001388888888888889 \cdot {x}^{6} + x \cdot \left(x \cdot 0.5\right)\right) - 0.041666666666666664 \cdot {x}^{4}
(FPCore (x) :precision binary64 (- 1.0 (cos x)))
(FPCore (x)
 :precision binary64
 (-
  (+ (* 0.001388888888888889 (pow x 6.0)) (* x (* x 0.5)))
  (* 0.041666666666666664 (pow x 4.0))))
double code(double x) {
	return 1.0 - cos(x);
}
double code(double x) {
	return ((0.001388888888888889 * pow(x, 6.0)) + (x * (x * 0.5))) - (0.041666666666666664 * pow(x, 4.0));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original30.0
Target0.0
Herbie0.0
\[\frac{\sin x \cdot \sin x}{1 + \cos x} \]

Derivation

  1. Initial program 30.0

    \[1 - \cos x \]
  2. Taylor expanded in x around 0 0.0

    \[\leadsto \color{blue}{\left(0.001388888888888889 \cdot {x}^{6} + 0.5 \cdot {x}^{2}\right) - 0.041666666666666664 \cdot {x}^{4}} \]
  3. Applied unpow2_binary640.0

    \[\leadsto \left(0.001388888888888889 \cdot {x}^{6} + 0.5 \cdot \color{blue}{\left(x \cdot x\right)}\right) - 0.041666666666666664 \cdot {x}^{4} \]
  4. Applied associate-*r*_binary640.0

    \[\leadsto \left(0.001388888888888889 \cdot {x}^{6} + \color{blue}{\left(0.5 \cdot x\right) \cdot x}\right) - 0.041666666666666664 \cdot {x}^{4} \]
  5. Final simplification0.0

    \[\leadsto \left(0.001388888888888889 \cdot {x}^{6} + x \cdot \left(x \cdot 0.5\right)\right) - 0.041666666666666664 \cdot {x}^{4} \]

Reproduce

herbie shell --seed 2022125 
(FPCore (x)
  :name "ENA, Section 1.4, Mentioned, A"
  :precision binary64
  :pre (and (<= -0.01 x) (<= x 0.01))

  :herbie-target
  (/ (* (sin x) (sin x)) (+ 1.0 (cos x)))

  (- 1.0 (cos x)))