Average Error: 27.6 → 2.4
Time: 53.2s
Precision: 64
\[\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}\;{sin}^{2} \le 0.0:\\ \;\;\;\;\frac{\cos \left(x \cdot 2\right)}{\left(\left(sin \cdot cos\right) \cdot x\right) \cdot \left(\left(sin \cdot cos\right) \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{\cos \left(x \cdot 2\right)} \cdot \log \left(e^{\sqrt[3]{\cos \left(x \cdot 2\right)}}\right)}{sin \cdot \left(cos \cdot x\right)} \cdot \frac{\sqrt[3]{\cos \left(x \cdot 2\right)}}{sin \cdot \left(cos \cdot x\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 (pow sin 2) < 0.0

    1. Initial program 61.7

      \[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
    2. Simplified9.9

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}}\]
    3. Taylor expanded around -inf 62.0

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

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

    if 0.0 < (pow sin 2)

    1. Initial program 22.5

      \[\frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot {sin}^{2}\right) \cdot x\right)}\]
    2. Simplified2.0

      \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt2.2

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{\cos \left(2 \cdot x\right)} \cdot \sqrt[3]{\cos \left(2 \cdot x\right)}\right) \cdot \sqrt[3]{\cos \left(2 \cdot x\right)}}}{\left(sin \cdot \left(x \cdot cos\right)\right) \cdot \left(sin \cdot \left(x \cdot cos\right)\right)}\]
    5. Applied times-frac1.9

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\cos \left(2 \cdot x\right)} \cdot \sqrt[3]{\cos \left(2 \cdot x\right)}}{sin \cdot \left(x \cdot cos\right)} \cdot \frac{\sqrt[3]{\cos \left(2 \cdot x\right)}}{sin \cdot \left(x \cdot cos\right)}}\]
    6. Using strategy rm
    7. Applied add-log-exp1.9

      \[\leadsto \frac{\sqrt[3]{\cos \left(2 \cdot x\right)} \cdot \color{blue}{\log \left(e^{\sqrt[3]{\cos \left(2 \cdot x\right)}}\right)}}{sin \cdot \left(x \cdot cos\right)} \cdot \frac{\sqrt[3]{\cos \left(2 \cdot x\right)}}{sin \cdot \left(x \cdot cos\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;{sin}^{2} \le 0.0:\\ \;\;\;\;\frac{\cos \left(x \cdot 2\right)}{\left(\left(sin \cdot cos\right) \cdot x\right) \cdot \left(\left(sin \cdot cos\right) \cdot x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{\cos \left(x \cdot 2\right)} \cdot \log \left(e^{\sqrt[3]{\cos \left(x \cdot 2\right)}}\right)}{sin \cdot \left(cos \cdot x\right)} \cdot \frac{\sqrt[3]{\cos \left(x \cdot 2\right)}}{sin \cdot \left(cos \cdot x\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2019100 
(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))))