Average Error: 31.7 → 0.3
Time: 32.1s
Precision: 64
Internal Precision: 128
\[\frac{1 - \cos x}{x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.010171680669651208 \lor \neg \left(x \le 0.012623359318410523\right):\\ \;\;\;\;\frac{1 - \cos x}{x} \cdot \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\left((\left(\cos x\right) \cdot \left(\cos x\right) + 1)_* - \cos x\right) \cdot (\frac{5}{24} \cdot \left(x \cdot x\right) + \left((\left({x}^{4}\right) \cdot \frac{-29}{720} + \frac{1}{2})_*\right))_*\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.010171680669651208 or 0.012623359318410523 < x

    1. Initial program 1.1

      \[\frac{1 - \cos x}{x \cdot x}\]
    2. Initial simplification1.1

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

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{1 - \cos x}{x}}\]

    if -0.010171680669651208 < x < 0.012623359318410523

    1. Initial program 61.4

      \[\frac{1 - \cos x}{x \cdot x}\]
    2. Initial simplification61.4

      \[\leadsto \frac{1 - \cos x}{x \cdot x}\]
    3. Using strategy rm
    4. Applied flip--61.4

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{1 + \cos x}}}{x \cdot x}\]
    5. Applied associate-/l/61.4

      \[\leadsto \color{blue}{\frac{1 \cdot 1 - \cos x \cdot \cos x}{\left(x \cdot x\right) \cdot \left(1 + \cos x\right)}}\]
    6. Simplified30.1

      \[\leadsto \frac{\color{blue}{\sin x \cdot \sin x}}{\left(x \cdot x\right) \cdot \left(1 + \cos x\right)}\]
    7. Using strategy rm
    8. Applied flip3-+30.1

      \[\leadsto \frac{\sin x \cdot \sin x}{\left(x \cdot x\right) \cdot \color{blue}{\frac{{1}^{3} + {\left(\cos x\right)}^{3}}{1 \cdot 1 + \left(\cos x \cdot \cos x - 1 \cdot \cos x\right)}}}\]
    9. Applied associate-*r/30.1

      \[\leadsto \frac{\sin x \cdot \sin x}{\color{blue}{\frac{\left(x \cdot x\right) \cdot \left({1}^{3} + {\left(\cos x\right)}^{3}\right)}{1 \cdot 1 + \left(\cos x \cdot \cos x - 1 \cdot \cos x\right)}}}\]
    10. Applied associate-/r/30.1

      \[\leadsto \color{blue}{\frac{\sin x \cdot \sin x}{\left(x \cdot x\right) \cdot \left({1}^{3} + {\left(\cos x\right)}^{3}\right)} \cdot \left(1 \cdot 1 + \left(\cos x \cdot \cos x - 1 \cdot \cos x\right)\right)}\]
    11. Simplified30.1

      \[\leadsto \frac{\sin x \cdot \sin x}{\left(x \cdot x\right) \cdot \left({1}^{3} + {\left(\cos x\right)}^{3}\right)} \cdot \color{blue}{\left((\left(\cos x\right) \cdot \left(\cos x\right) + 1)_* - \cos x\right)}\]
    12. Taylor expanded around 0 0.0

      \[\leadsto \color{blue}{\left(\left(\frac{5}{24} \cdot {x}^{2} + \frac{1}{2}\right) - \frac{29}{720} \cdot {x}^{4}\right)} \cdot \left((\left(\cos x\right) \cdot \left(\cos x\right) + 1)_* - \cos x\right)\]
    13. Simplified0.0

      \[\leadsto \color{blue}{(\frac{5}{24} \cdot \left(x \cdot x\right) + \left((\left({x}^{4}\right) \cdot \frac{-29}{720} + \frac{1}{2})_*\right))_*} \cdot \left((\left(\cos x\right) \cdot \left(\cos x\right) + 1)_* - \cos x\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.010171680669651208 \lor \neg \left(x \le 0.012623359318410523\right):\\ \;\;\;\;\frac{1 - \cos x}{x} \cdot \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\left((\left(\cos x\right) \cdot \left(\cos x\right) + 1)_* - \cos x\right) \cdot (\frac{5}{24} \cdot \left(x \cdot x\right) + \left((\left({x}^{4}\right) \cdot \frac{-29}{720} + \frac{1}{2})_*\right))_*\\ \end{array}\]

Runtime

Time bar (total: 32.1s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes15.90.30.015.898.5%
herbie shell --seed 2018352 +o rules:numerics
(FPCore (x)
  :name "cos2 (problem 3.4.1)"
  (/ (- 1 (cos x)) (* x x)))