Average Error: 27.0 → 1.6
Time: 49.0s
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)}{\sqrt{{cos}^{2}} \cdot \left(\left(\left(sin \cdot x\right) \cdot \left(sin \cdot x\right)\right) \cdot \left|cos\right|\right)} \le 1.139874212304426 \cdot 10^{+303}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{{\left(\left|cos \cdot \left(x \cdot sin\right)\right|\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(2 \cdot x\right) \cdot \frac{1}{\left|\left(x \cdot cos\right) \cdot sin\right| \cdot \left|\left(x \cdot cos\right) \cdot sin\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)) (* (sqrt (pow cos 2)) (* (* (* sin x) (* sin x)) (fabs cos)))) < 1.139874212304426e+303

    1. Initial program 17.4

      \[\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-sqrt17.5

      \[\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 simplify17.4

      \[\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 simplify2.4

      \[\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.7

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

    if 1.139874212304426e+303 < (/ (cos (* 2 x)) (* (sqrt (pow cos 2)) (* (* (* sin x) (* sin x)) (fabs cos))))

    1. Initial program 61.4

      \[\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-sqrt61.4

      \[\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 simplify61.4

      \[\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 simplify4.9

      \[\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 div-inv4.9

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

Runtime

Time bar (total: 49.0s)Debug logProfile

herbie shell --seed '#(1071979731 1496239409 439705970 2863295848 982327776 189749553)' +o rules:numerics
(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))))