Average Error: 31.8 → 0.3
Time: 20.8s
Precision: 64
Internal precision: 2432
\[\frac{1 - \cos x}{{x}^2}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.2745508074835617 \cdot 10^{-14}:\\ \;\;\;\;\frac{\frac{\sin x \cdot \sin x}{x}}{1 + {\left(\cos x\right)}^{3}} \cdot \frac{\left(1 - \cos x\right) + \cos x \cdot \cos x}{x}\\ \mathbf{if}\;x \le 1850694803779224.5:\\ \;\;\;\;\left(\frac{1}{2} + \frac{1}{720} \cdot {x}^{4}\right) - \frac{1}{24} \cdot {x}^{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sin x \cdot \sin x}{x}}{1 + {\left(\cos x\right)}^{3}} \cdot \frac{\left(1 - \cos x\right) + \cos x \cdot \cos x}{x}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes.
  2. if x < -1.2745508074835617e-14 or 1850694803779224.5 < x

    1. Initial program 1.8

      \[\frac{1 - \cos x}{{x}^2}\]
    2. Using strategy rm
    3. Applied flip-- 2.0

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{1 + \cos x}}}{{x}^2}\]
    4. Applied simplify 1.1

      \[\leadsto \frac{\frac{\color{blue}{\sin x \cdot \sin x}}{1 + \cos x}}{{x}^2}\]
    5. Using strategy rm
    6. Applied square-mult 1.1

      \[\leadsto \frac{\frac{\sin x \cdot \sin x}{1 + \cos x}}{\color{blue}{x \cdot x}}\]
    7. Applied flip3-+ 1.1

      \[\leadsto \frac{\frac{\sin x \cdot \sin x}{\color{blue}{\frac{{1}^{3} + {\left(\cos x\right)}^{3}}{1 \cdot 1 + \left(\cos x \cdot \cos x - 1 \cdot \cos x\right)}}}}{x \cdot x}\]
    8. Applied associate-/r/ 1.1

      \[\leadsto \frac{\color{blue}{\frac{\sin x \cdot \sin x}{{1}^{3} + {\left(\cos x\right)}^{3}} \cdot \left(1 \cdot 1 + \left(\cos x \cdot \cos x - 1 \cdot \cos x\right)\right)}}{x \cdot x}\]
    9. Applied times-frac 0.6

      \[\leadsto \color{blue}{\frac{\frac{\sin x \cdot \sin x}{{1}^{3} + {\left(\cos x\right)}^{3}}}{x} \cdot \frac{1 \cdot 1 + \left(\cos x \cdot \cos x - 1 \cdot \cos x\right)}{x}}\]
    10. Applied simplify 0.6

      \[\leadsto \color{blue}{\frac{\frac{\sin x \cdot \sin x}{x}}{1 + {\left(\cos x\right)}^{3}}} \cdot \frac{1 \cdot 1 + \left(\cos x \cdot \cos x - 1 \cdot \cos x\right)}{x}\]
    11. Applied simplify 0.6

      \[\leadsto \frac{\frac{\sin x \cdot \sin x}{x}}{1 + {\left(\cos x\right)}^{3}} \cdot \color{blue}{\frac{\left(1 - \cos x\right) + \cos x \cdot \cos x}{x}}\]

    if -1.2745508074835617e-14 < x < 1850694803779224.5

    1. Initial program 61.4

      \[\frac{1 - \cos x}{{x}^2}\]
    2. Applied taylor 0.0

      \[\leadsto \left(\frac{1}{2} + \frac{1}{720} \cdot {x}^{4}\right) - \frac{1}{24} \cdot {x}^{2}\]
    3. Taylor expanded around 0 0.0

      \[\leadsto \color{blue}{\left(\frac{1}{2} + \frac{1}{720} \cdot {x}^{4}\right) - \frac{1}{24} \cdot {x}^{2}}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 20.8s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1067901057 3396600083 3715501224 3126139233 3908045574 1593683916)'
(FPCore (x)
  :name "cos2 (problem 3.4.1)"
  (/ (- 1 (cos x)) (sqr x)))