Average Error: 28.2 → 2.5
Time: 11.8s
Precision: binary64
Cost: 20160
\[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}\]
\[\frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left|x \cdot s\right|}}{c \cdot \left|x \cdot s\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(2 \cdot x\right)}{c \cdot \left|x \cdot s\right|}}{c \cdot \left|x \cdot s\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 (* 2.0 x)) (* c (fabs (* x s)))) (* c (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(2.0 * x) / (c * fabs(x * s))) / (c * 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

Alternatives

Alternative 1
Error2.8
Cost19968
\[\frac{1}{\frac{{\left(c \cdot \left|x \cdot s\right|\right)}^{2}}{\cos \left(2 \cdot x\right)}}\]
Alternative 2
Error2.8
Cost19840
\[\frac{\cos \left(2 \cdot x\right)}{{\left(c \cdot \left|x \cdot s\right|\right)}^{2}}\]
Alternative 3
Error11.9
Cost13905
\[\begin{array}{l} \mathbf{if}\;c \leq -8.065984647911511 \cdot 10^{+102} \lor \neg \left(c \leq -1.9446361780504217 \cdot 10^{-157} \lor \neg \left(c \leq 5.632597730250348 \cdot 10^{-147}\right) \land c \leq 2.0376561209920545 \cdot 10^{+93}\right):\\ \;\;\;\;\frac{1}{{\left(c \cdot \left|x \cdot s\right|\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left(c \cdot c\right) \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)}\\ \end{array}\]
Alternative 4
Error17.5
Cost7688
\[\begin{array}{l} \mathbf{if}\;c \leq -9.977162136642538 \cdot 10^{-137} \lor \neg \left(c \leq 2.1907951057584004 \cdot 10^{-187}\right):\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left(c \cdot c\right) \cdot \left(\left(x \cdot s\right) \cdot \left(x \cdot s\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{c \cdot \left(c \cdot \left(x \cdot \left(x \cdot \left(s \cdot s\right)\right)\right)\right)}\\ \end{array}\]
Alternative 5
Error22.3
Cost7688
\[\begin{array}{l} \mathbf{if}\;s \leq -2.1875156225120967 \cdot 10^{-150} \lor \neg \left(s \leq 1.5984194736341986 \cdot 10^{-162}\right):\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{c \cdot \left(c \cdot \left(x \cdot \left(x \cdot \left(s \cdot s\right)\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 6
Error26.8
Cost8002
\[\begin{array}{l} \mathbf{if}\;s \leq -2.1875156225120967 \cdot 10^{-150}:\\ \;\;\;\;\frac{\cos \left(2 \cdot x\right)}{\left(c \cdot c\right) \cdot \left(x \cdot \left(x \cdot \left(s \cdot s\right)\right)\right)}\\ \mathbf{elif}\;s \leq 1.5984194736341986 \cdot 10^{-162}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot c}}{x \cdot \left(x \cdot \left(s \cdot s\right)\right)}\\ \end{array}\]
Alternative 7
Error26.9
Cost7688
\[\begin{array}{l} \mathbf{if}\;s \leq -2.1875156225120967 \cdot 10^{-150} \lor \neg \left(s \leq 1.5984194736341986 \cdot 10^{-162}\right):\\ \;\;\;\;\frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot c}}{x \cdot \left(x \cdot \left(s \cdot s\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 8
Error29.3
Cost3010
\[\begin{array}{l} \mathbf{if}\;x \leq -0.01491765082005961:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 7.662776146193135 \cdot 10^{+26}:\\ \;\;\;\;0.6666666666666666 \cdot \frac{x \cdot x}{\left(c \cdot c\right) \cdot \left(s \cdot s\right)} + \left(\frac{1}{\left(c \cdot c\right) \cdot \left(x \cdot \left(x \cdot \left(s \cdot s\right)\right)\right)} - \frac{2}{\left(c \cdot c\right) \cdot \left(s \cdot s\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 9
Error29.4
Cost1474
\[\begin{array}{l} \mathbf{if}\;x \leq -0.01491765082005961:\\ \;\;\;\;0\\ \mathbf{elif}\;x \leq 2.3289896555315027 \cdot 10^{+109}:\\ \;\;\;\;\frac{1}{\left(c \cdot c\right) \cdot \left(x \cdot \left(x \cdot \left(s \cdot s\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
Alternative 10
Error33.4
Cost64
\[0\]
Alternative 11
Error61.5
Cost64
\[1\]

Error

Derivation

  1. Initial program 28.2

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}\]
  2. Simplified28.2

    \[\leadsto \color{blue}{\frac{\cos \left(2 \cdot x\right)}{\left(c \cdot c\right) \cdot \left(x \cdot \left(x \cdot \left(s \cdot s\right)\right)\right)}}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt_binary64_44128.3

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(c \cdot c\right) \cdot \color{blue}{\left(\sqrt{x \cdot \left(x \cdot \left(s \cdot s\right)\right)} \cdot \sqrt{x \cdot \left(x \cdot \left(s \cdot s\right)\right)}\right)}}\]
  5. Simplified28.3

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

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

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

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

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

    \[\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)}}\]
  13. Applied associate-/r*_binary64_3632.5

    \[\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|}}\]
  14. Simplified2.5

    \[\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|}\]
  15. Simplified2.5

    \[\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|}}\]
  16. Final simplification2.5

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

Reproduce

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