Average Error: 31.1 → 0.4
Time: 39.0s
Precision: 64
Internal Precision: 2432
\[\frac{1 - \cos x}{x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.030873211515654683:\\ \;\;\;\;\frac{\frac{{1}^{3} - {\left(\cos x\right)}^{3}}{\cos x + (\left(\cos x\right) \cdot \left(\cos x\right) + 1)_*}}{x \cdot x}\\ \mathbf{if}\;x \le 0.009057629836652807:\\ \;\;\;\;(\left({x}^{4}\right) \cdot \frac{1}{720} + \frac{1}{2})_* - x \cdot \left(\frac{1}{24} \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\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}\\ \end{array}\]

Error

Bits error versus x

Derivation

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

    1. Initial program 1.0

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

      \[\leadsto \frac{\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}\]
    4. Applied simplify1.1

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

    if -0.030873211515654683 < x < 0.009057629836652807

    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}}\]
    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.009057629836652807 < x

    1. Initial program 1.1

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

      \[\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-sqr-sqrt1.3

      \[\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}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 39.0s)Debug logProfile

herbie shell --seed '#(1064173506 2580572819 2847706409 4129882574 1125180799 1845288547)' +o rules:numerics
(FPCore (x)
  :name "cos2 (problem 3.4.1)"
  (/ (- 1 (cos x)) (* x x)))