Average Error: 27.6 → 2.7
Time: 8.4s
Precision: binary64
\[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}\]
\[\frac{\frac{\frac{\cos \left(x \cdot 2\right)}{\left|x \cdot s\right|}}{c}}{\left|x \cdot s\right| \cdot c}\]
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\frac{\frac{\frac{\cos \left(x \cdot 2\right)}{\left|x \cdot s\right|}}{c}}{\left|x \cdot s\right| \cdot c}
(FPCore (x c s)
 :precision binary64
 (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))
(FPCore (x c s)
 :precision binary64
 (/ (/ (/ (cos (* x 2.0)) (fabs (* x s))) c) (* (fabs (* x s)) c)))
double code(double x, double c, double s) {
	return cos(2.0 * x) / (pow(c, 2.0) * ((x * pow(s, 2.0)) * x));
}
double code(double x, double c, double s) {
	return ((cos(x * 2.0) / fabs(x * s)) / c) / (fabs(x * s) * c);
}

Error

Bits error versus x

Bits error versus c

Bits error versus s

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 27.6

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

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{\left(\sqrt{\left(x \cdot {s}^{2}\right) \cdot x} \cdot \sqrt{\left(x \cdot {s}^{2}\right) \cdot x}\right)}}\]
  4. Simplified27.6

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\color{blue}{\left|s \cdot x\right|} \cdot \sqrt{\left(x \cdot {s}^{2}\right) \cdot x}\right)}\]
  5. Simplified19.8

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left|s \cdot x\right| \cdot \color{blue}{\left|s \cdot x\right|}\right)}\]
  6. Using strategy rm
  7. Applied pow2_binary6419.8

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \color{blue}{{\left(\left|s \cdot x\right|\right)}^{2}}}\]
  8. Applied pow-prod-down_binary642.9

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{{\left(c \cdot \left|s \cdot x\right|\right)}^{2}}}\]
  9. Simplified2.9

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{{\color{blue}{\left(\left|s \cdot x\right| \cdot c\right)}}^{2}}\]
  10. Using strategy rm
  11. Applied unpow2_binary642.9

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(\left|s \cdot x\right| \cdot c\right) \cdot \left(\left|s \cdot x\right| \cdot c\right)}}\]
  12. Applied associate-/r*_binary642.6

    \[\leadsto \color{blue}{\frac{\frac{\cos \left(2 \cdot x\right)}{\left|s \cdot x\right| \cdot c}}{\left|s \cdot x\right| \cdot c}}\]
  13. Simplified2.6

    \[\leadsto \frac{\color{blue}{\frac{\cos \left(x \cdot 2\right)}{\left|s \cdot x\right| \cdot c}}}{\left|s \cdot x\right| \cdot c}\]
  14. Using strategy rm
  15. Applied associate-/r*_binary642.7

    \[\leadsto \frac{\color{blue}{\frac{\frac{\cos \left(x \cdot 2\right)}{\left|s \cdot x\right|}}{c}}}{\left|s \cdot x\right| \cdot c}\]
  16. Final simplification2.7

    \[\leadsto \frac{\frac{\frac{\cos \left(x \cdot 2\right)}{\left|x \cdot s\right|}}{c}}{\left|x \cdot s\right| \cdot c}\]

Alternatives

Reproduce

herbie shell --seed 2021118 
(FPCore (x c s)
  :name "mixedcos"
  :precision binary64
  (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))