Average Error: 31.1 → 0.3
Time: 15.0s
Precision: 64
Internal precision: 2432
\[\frac{1 - \cos x}{{x}^2}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.010384934750878 \cdot 10^{-06}:\\ \;\;\;\;{\left(\frac{\sqrt{\frac{{\left(\sin x\right)}^2}{1 + \cos x}}}{x}\right)}^2\\ \mathbf{if}\;x \le 0.0309538262003119:\\ \;\;\;\;\left(\frac{1}{2} + \frac{1}{720} \cdot {x}^{4}\right) - \frac{1}{24} \cdot {x}^2\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\sqrt{\frac{{\left(\sin x\right)}^2}{1 + \cos x}}}{x}\right)}^2\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes.
  2. if x < -4.010384934750878e-06 or 0.0309538262003119 < x

    1. Initial program 1.3

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

      \[\leadsto \frac{\color{blue}{\frac{{1}^2 - {\left(\cos x\right)}^2}{1 + \cos x}}}{{x}^2}\]
    4. Applied simplify 1.2

      \[\leadsto \frac{\frac{\color{blue}{\sin x \cdot \sin x}}{1 + \cos x}}{{x}^2}\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt 1.3

      \[\leadsto \frac{\color{blue}{{\left(\sqrt{\frac{\sin x \cdot \sin x}{1 + \cos x}}\right)}^2}}{{x}^2}\]
    7. Applied square-undiv 0.6

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

      \[\leadsto {\color{blue}{\left(\frac{\sqrt{\frac{{\left(\sin x\right)}^2}{1 + \cos x}}}{x}\right)}}^2\]

    if -4.010384934750878e-06 < x < 0.0309538262003119

    1. Initial program 61.5

      \[\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: 15.0s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1066785882 2324371342 4059510649 1466361199 2701357084 1216585281)'
(FPCore (x)
  :name "cos2 (problem 3.4.1)"
  (/ (- 1 (cos x)) (sqr x)))