Average Error: 27.0 → 1.8
Time: 49.3s
Precision: 64
Internal Precision: 576
\[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\cos \left(2 \cdot x\right)}{\left({cos}^{2} \cdot \left(x \cdot {sin}^{2}\right)\right) \cdot x} \le +\infty:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{{\left(\left|cos \cdot \left(x \cdot sin\right)\right|\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left|\left(x \cdot cos\right) \cdot sin\right| \cdot \left|x \cdot \left(cos \cdot sin\right)\right|}\\ \end{array}\]

Error

Bits error versus x

Bits error versus cos

Bits error versus sin

Derivation

  1. Split input into 2 regimes
  2. if (/ (cos (* 2 x)) (* (* (pow cos 2) (* x (pow sin 2))) x)) < +inf.0

    1. Initial program 19.9

      \[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt19.9

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\sqrt{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)} \cdot \sqrt{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}}}\]
    4. Applied simplify19.8

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left|\left(x \cdot cos\right) \cdot sin\right|} \cdot \sqrt{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}}\]
    5. Applied simplify1.5

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left|\left(x \cdot cos\right) \cdot sin\right| \cdot \color{blue}{\left|\left(x \cdot cos\right) \cdot sin\right|}}\]
    6. Taylor expanded around 0 0.6

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{\left(\left|cos \cdot \left(x \cdot sin\right)\right|\right)}^{2}}}\]

    if +inf.0 < (/ (cos (* 2 x)) (* (* (pow cos 2) (* x (pow sin 2))) x))

    1. Initial program 62.2

      \[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt62.2

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\sqrt{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)} \cdot \sqrt{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}}}\]
    4. Applied simplify62.2

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left|\left(x \cdot cos\right) \cdot sin\right|} \cdot \sqrt{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}}\]
    5. Applied simplify8.0

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left|\left(x \cdot cos\right) \cdot sin\right| \cdot \color{blue}{\left|\left(x \cdot cos\right) \cdot sin\right|}}\]
    6. Using strategy rm
    7. Applied associate-*l*7.9

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

Runtime

Time bar (total: 49.3s)Debug logProfile

herbie shell --seed '#(1071119240 1686926585 3481876196 78132896 2080707795 3185793749)' 
(FPCore (x cos sin)
  :name "cos(2*x)/(cos^2(x)*sin^2(x))"
  (/ (cos (* 2 x)) (* (pow cos 2) (* (* x (pow sin 2)) x))))