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

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if (cbrt (/ (* (* (tan (/ x 2)) (sin x)) (* (tan (/ x 2)) (sin x))) (/ (pow (* x x) 3) (* (tan (/ x 2)) (sin x))))) < 0.499211235226664

    1. Initial program 1.0

      \[\frac{1 - \cos x}{x \cdot x}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt1.4

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

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

    if 0.499211235226664 < (cbrt (/ (* (* (tan (/ x 2)) (sin x)) (* (tan (/ x 2)) (sin x))) (/ (pow (* x x) 3) (* (tan (/ x 2)) (sin x)))))

    1. Initial program 61.1

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

Runtime

Time bar (total: 50.0s)Debug logProfile

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