Average Error: 31.0 → 0.4
Time: 45.4s
Precision: 64
Internal Precision: 2368
\[\frac{1 - \cos x}{x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.011267105967474822:\\ \;\;\;\;\sqrt{\frac{\tan \left(\frac{x}{2}\right)}{\frac{x \cdot x}{\sin x}}} \cdot \sqrt{\frac{\tan \left(\frac{x}{2}\right)}{\frac{x \cdot x}{\sin x}}}\\ \mathbf{if}\;x \le 0.03431957790803754:\\ \;\;\;\;\left(\frac{1}{2} + \frac{1}{720} \cdot {x}^{4}\right) - \frac{1}{24} \cdot {x}^{2}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\tan \left(\frac{x}{2}\right) \cdot \sin x} \cdot \frac{\sqrt[3]{\tan \left(\frac{x}{2}\right) \cdot \sin x}}{x}\right) \cdot \frac{\sqrt[3]{\tan \left(\frac{x}{2}\right) \cdot \sin x}}{x}\\ \end{array}\]

Error

Bits error versus x

Derivation

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

    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 \color{blue}{\sqrt{\frac{\frac{\sin x \cdot \sin x}{1 + \cos x}}{x \cdot x}} \cdot \sqrt{\frac{\frac{\sin x \cdot \sin x}{1 + \cos x}}{x \cdot x}}}\]
    7. Applied simplify1.1

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

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

    if -0.011267105967474822 < x < 0.03431957790803754

    1. Initial program 61.4

      \[\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}}\]

    if 0.03431957790803754 < x

    1. Initial program 1.1

      \[\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.2

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

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

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

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

      \[\leadsto \left(\sqrt[3]{\tan \left(\frac{x}{2}\right) \cdot \sin x} \cdot \frac{\sqrt[3]{\tan \left(\frac{x}{2}\right) \cdot \sin x}}{x}\right) \cdot \color{blue}{\frac{\sqrt[3]{\tan \left(\frac{x}{2}\right) \cdot \sin x}}{x}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 45.4s)Debug logProfile

herbie shell --seed '#(1071373924 2949776965 1885069702 3247780810 90874544 2263903749)' 
(FPCore (x)
  :name "cos2 (problem 3.4.1)"
  (/ (- 1 (cos x)) (* x x)))