Average Error: 27.2 → 1.6
Time: 51.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|\left(x \cdot cos\right) \cdot sin\right| \cdot \left|x \cdot \left(cos \cdot sin\right)\right|} \le 2.050901824264872 \cdot 10^{-261}:\\ \;\;\;\;\frac{\cos x \cdot \cos x}{{\left(\left|cos \cdot \left(x \cdot sin\right)\right|\right)}^{2}} - \frac{\sin x \cdot \sin x}{{\left(\left|cos \cdot \left(x \cdot sin\right)\right|\right)}^{2}}\\ \mathbf{if}\;\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|} \le 1.649318375652456 \cdot 10^{+295}:\\ \;\;\;\;\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|}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos x \cdot \cos x}{{\left(\left|cos \cdot \left(x \cdot sin\right)\right|\right)}^{2}} - \frac{\sin x \cdot \sin x}{{\left(\left|cos \cdot \left(x \cdot sin\right)\right|\right)}^{2}}\\ \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)) (* (fabs (* (* x cos) sin)) (fabs (* x (* cos sin))))) < 2.050901824264872e-261 or 1.649318375652456e+295 < (/ (cos (* 2 x)) (* (fabs (* (* x cos) sin)) (fabs (* x (* cos sin)))))

    1. Initial program 19.5

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

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

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{\left(\left|cos \cdot \left(x \cdot sin\right)\right|\right)}^{2}}}\]
    7. Using strategy rm
    8. Applied cos-21.9

      \[\leadsto \frac{\color{blue}{\cos x \cdot \cos x - \sin x \cdot \sin x}}{{\left(\left|cos \cdot \left(x \cdot sin\right)\right|\right)}^{2}}\]
    9. Applied div-sub1.9

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

    if 2.050901824264872e-261 < (/ (cos (* 2 x)) (* (fabs (* (* x cos) sin)) (fabs (* x (* cos sin))))) < 1.649318375652456e+295

    1. Initial program 43.1

      \[\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-sqrt43.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 simplify43.1

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

      \[\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: 51.3s)Debug logProfile

herbie shell --seed '#(1071501266 3581234924 1086666455 2685055582 1243441566 1802958749)' 
(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))))