Average Error: 26.7 → 1.7
Time: 1.4m
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}\;\left(\sqrt[3]{\frac{\cos \left(2 \cdot x\right)}{\left(cos \cdot \left(x \cdot sin\right)\right) \cdot \left(cos \cdot \left(x \cdot sin\right)\right)}} \cdot \sqrt[3]{\frac{\cos \left(2 \cdot x\right)}{\left(cos \cdot \left(x \cdot sin\right)\right) \cdot \left(cos \cdot \left(x \cdot sin\right)\right)}}\right) \cdot \sqrt[3]{\frac{\cos \left(2 \cdot x\right)}{\left(cos \cdot \left(x \cdot sin\right)\right) \cdot \left(cos \cdot \left(x \cdot sin\right)\right)}} \le 1.776222557545012 \cdot 10^{+308}:\\ \;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{cos \cdot \left(x \cdot sin\right)}}{cos \cdot \left(x \cdot sin\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(e^{\log \left(\frac{\cos \left(2 \cdot x\right)}{\left(x \cdot \left(sin \cdot cos\right)\right) \cdot \left(x \cdot \left(sin \cdot cos\right)\right)}\right)}\right)}\\ \end{array}\]

Error

Bits error versus x

Bits error versus cos

Bits error versus sin

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (* (* (cbrt (/ (cos (* x 2)) (* (* (* sin x) cos) (* (* sin x) cos)))) (cbrt (/ (cos (* x 2)) (* (* (* sin x) cos) (* (* sin x) cos))))) (cbrt (/ (cos (* x 2)) (* (* (* sin x) cos) (* (* sin x) cos))))) < 1.776222557545012e+308

    1. Initial program 26.3

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot \color{blue}{\left(sin \cdot sin\right)}\right) \cdot x\right)}\]
    4. Applied associate-*r*20.2

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\color{blue}{\left(\left(x \cdot sin\right) \cdot sin\right)} \cdot x\right)}\]
    5. Using strategy rm
    6. Applied add-exp-log21.3

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{e^{\log \left({cos}^{2} \cdot \left(\left(\left(x \cdot sin\right) \cdot sin\right) \cdot x\right)\right)}}}\]
    7. Applied add-exp-log35.7

      \[\leadsto \frac{\color{blue}{e^{\log \left(\cos \left(2 \cdot x\right)\right)}}}{e^{\log \left({cos}^{2} \cdot \left(\left(\left(x \cdot sin\right) \cdot sin\right) \cdot x\right)\right)}}\]
    8. Applied div-exp35.7

      \[\leadsto \color{blue}{e^{\log \left(\cos \left(2 \cdot x\right)\right) - \log \left({cos}^{2} \cdot \left(\left(\left(x \cdot sin\right) \cdot sin\right) \cdot x\right)\right)}}\]
    9. Simplified11.6

      \[\leadsto e^{\color{blue}{\log \left(\frac{\cos \left(x \cdot 2\right)}{\left(\left(sin \cdot x\right) \cdot cos\right) \cdot \left(\left(sin \cdot x\right) \cdot cos\right)}\right)}}\]
    10. Using strategy rm
    11. Applied rem-exp-log1.9

      \[\leadsto \color{blue}{\frac{\cos \left(x \cdot 2\right)}{\left(\left(sin \cdot x\right) \cdot cos\right) \cdot \left(\left(sin \cdot x\right) \cdot cos\right)}}\]
    12. Using strategy rm
    13. Applied associate-/r*1.6

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

    if 1.776222557545012e+308 < (* (* (cbrt (/ (cos (* x 2)) (* (* (* sin x) cos) (* (* sin x) cos)))) (cbrt (/ (cos (* x 2)) (* (* (* sin x) cos) (* (* sin x) cos))))) (cbrt (/ (cos (* x 2)) (* (* (* sin x) cos) (* (* sin x) cos)))))

    1. Initial program 60.0

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

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\left(x \cdot \color{blue}{\left(sin \cdot sin\right)}\right) \cdot x\right)}\]
    4. Applied associate-*r*60.0

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{cos}^{2} \cdot \left(\color{blue}{\left(\left(x \cdot sin\right) \cdot sin\right)} \cdot x\right)}\]
    5. Using strategy rm
    6. Applied add-exp-log60.0

      \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{e^{\log \left({cos}^{2} \cdot \left(\left(\left(x \cdot sin\right) \cdot sin\right) \cdot x\right)\right)}}}\]
    7. Applied add-exp-log60.0

      \[\leadsto \frac{\color{blue}{e^{\log \left(\cos \left(2 \cdot x\right)\right)}}}{e^{\log \left({cos}^{2} \cdot \left(\left(\left(x \cdot sin\right) \cdot sin\right) \cdot x\right)\right)}}\]
    8. Applied div-exp60.0

      \[\leadsto \color{blue}{e^{\log \left(\cos \left(2 \cdot x\right)\right) - \log \left({cos}^{2} \cdot \left(\left(\left(x \cdot sin\right) \cdot sin\right) \cdot x\right)\right)}}\]
    9. Simplified60.0

      \[\leadsto e^{\color{blue}{\log \left(\frac{\cos \left(x \cdot 2\right)}{\left(\left(sin \cdot x\right) \cdot cos\right) \cdot \left(\left(sin \cdot x\right) \cdot cos\right)}\right)}}\]
    10. Using strategy rm
    11. Applied add-exp-log60.0

      \[\leadsto e^{\log \left(\frac{\cos \left(x \cdot 2\right)}{\color{blue}{e^{\log \left(\left(\left(sin \cdot x\right) \cdot cos\right) \cdot \left(\left(sin \cdot x\right) \cdot cos\right)\right)}}}\right)}\]
    12. Applied add-exp-log60.0

      \[\leadsto e^{\log \left(\frac{\color{blue}{e^{\log \left(\cos \left(x \cdot 2\right)\right)}}}{e^{\log \left(\left(\left(sin \cdot x\right) \cdot cos\right) \cdot \left(\left(sin \cdot x\right) \cdot cos\right)\right)}}\right)}\]
    13. Applied div-exp60.0

      \[\leadsto e^{\log \color{blue}{\left(e^{\log \left(\cos \left(x \cdot 2\right)\right) - \log \left(\left(\left(sin \cdot x\right) \cdot cos\right) \cdot \left(\left(sin \cdot x\right) \cdot cos\right)\right)}\right)}}\]
    14. Simplified7.5

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

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

Runtime

Time bar (total: 1.4m)Debug logProfile

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