Average Error: 28.6 → 2.9
Time: 9.2s
Precision: binary64
\[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}\]
\[\frac{\frac{\cos \left(x \cdot 2\right)}{c \cdot \left|x \cdot s\right|}}{\sqrt{\left|x \cdot s\right|} \cdot \left(c \cdot \sqrt{\left|x \cdot s\right|}\right)}\]
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\frac{\frac{\cos \left(x \cdot 2\right)}{c \cdot \left|x \cdot s\right|}}{\sqrt{\left|x \cdot s\right|} \cdot \left(c \cdot \sqrt{\left|x \cdot s\right|}\right)}
(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)) (* c (fabs (* x s))))
  (* (sqrt (fabs (* x s))) (* c (sqrt (fabs (* x s)))))))
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) / (c * fabs(x * s))) / (sqrt(fabs(x * s)) * (c * sqrt(fabs(x * s))));
}

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 28.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_binary6428.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. Simplified28.6

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{\cos \left(x \cdot 2\right)}{c \cdot \left|x \cdot s\right|}}}{c \cdot \left|x \cdot s\right|}\]
  13. Using strategy rm
  14. Applied add-sqr-sqrt_binary643.0

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

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

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

Reproduce

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