Average Error: 30.8 → 0.3
Time: 1.1m
Precision: 64
Internal Precision: 2368
\[\frac{1 - \cos x}{x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.012657602632365025:\\ \;\;\;\;\frac{1}{x} \cdot \frac{\sin x \cdot \sin x}{(\left(\cos x\right) \cdot x + x)_*}\\ \mathbf{if}\;x \le 2.4971237599145835 \cdot 10^{-05}:\\ \;\;\;\;(\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{\sin x \cdot \sin x}{(\left(\cos x\right) \cdot x + x)_*}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.012657602632365025 or 2.4971237599145835e-05 < 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.1

      \[\leadsto \frac{\frac{\color{blue}{\sin x \cdot \sin x}}{1 + \cos x}}{x \cdot x}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity1.1

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

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

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

    if -0.012657602632365025 < x < 2.4971237599145835e-05

    1. Initial program 61.5

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

Runtime

Time bar (total: 1.1m)Debug logProfile

herbie shell --seed '#(1071821486 549052472 3784827256 1559736200 3548510075 881134285)' +o rules:numerics
(FPCore (x)
  :name "cos2 (problem 3.4.1)"
  (/ (- 1 (cos x)) (* x x)))