Average Error: 31.1 → 0.2
Time: 48.3s
Precision: 64
Internal Precision: 2432
\[\frac{1 - \cos x}{x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.011697034210601627:\\ \;\;\;\;\frac{\sqrt{\tan \left(\frac{x}{2}\right) \cdot \sin x}}{x} \cdot \frac{\sqrt{\tan \left(\frac{x}{2}\right) \cdot \sin x}}{x}\\ \mathbf{if}\;x \le 0.03221387480965043:\\ \;\;\;\;(\left({x}^{4}\right) \cdot \frac{1}{720} + \frac{1}{2})_* - x \cdot \left(\frac{1}{24} \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{1 - \cos x}{x}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if x < -0.011697034210601627

    1. Initial program 1.0

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

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{1 + \cos x}}}{x \cdot x}\]
    4. Applied simplify1.1

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

      \[\leadsto \frac{\color{blue}{\sqrt{\frac{\sin x \cdot \sin x}{1 + \cos x}} \cdot \sqrt{\frac{\sin x \cdot \sin x}{1 + \cos x}}}}{x \cdot x}\]
    7. Applied times-frac0.7

      \[\leadsto \color{blue}{\frac{\sqrt{\frac{\sin x \cdot \sin x}{1 + \cos x}}}{x} \cdot \frac{\sqrt{\frac{\sin x \cdot \sin x}{1 + \cos x}}}{x}}\]
    8. Applied simplify0.5

      \[\leadsto \color{blue}{\frac{\sqrt{\tan \left(\frac{x}{2}\right) \cdot \sin x}}{x}} \cdot \frac{\sqrt{\frac{\sin x \cdot \sin x}{1 + \cos x}}}{x}\]
    9. Applied simplify0.4

      \[\leadsto \frac{\sqrt{\tan \left(\frac{x}{2}\right) \cdot \sin x}}{x} \cdot \color{blue}{\frac{\sqrt{\tan \left(\frac{x}{2}\right) \cdot \sin x}}{x}}\]

    if -0.011697034210601627 < x < 0.03221387480965043

    1. Initial program 61.3

      \[\frac{1 - \cos x}{x \cdot x}\]
    2. 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. Applied simplify0.0

      \[\leadsto \color{blue}{(\left({x}^{4}\right) \cdot \frac{1}{720} + \frac{1}{2})_* - x \cdot \left(\frac{1}{24} \cdot x\right)}\]

    if 0.03221387480965043 < x

    1. Initial program 1.1

      \[\frac{1 - \cos x}{x \cdot x}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity1.1

      \[\leadsto \frac{\color{blue}{1 \cdot \left(1 - \cos x\right)}}{x \cdot x}\]
    4. Applied times-frac0.5

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{1 - \cos x}{x}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 48.3s)Debug logProfile

herbie shell --seed '#(1070864556 424010669 783715395 1203517814 4070606583 4107618214)' +o rules:numerics
(FPCore (x)
  :name "cos2 (problem 3.4.1)"
  (/ (- 1 (cos x)) (* x x)))