Average Error: 27.7 → 2.6
Time: 8.8s
Precision: binary64
\[[c, s] = \mathsf{sort}([c, s]) \\]
\[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
\[\frac{1}{c \cdot \left(s \cdot x\right)} \cdot \frac{\frac{\cos \left(x \cdot 2\right)}{c}}{s \cdot x} \]
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\frac{1}{c \cdot \left(s \cdot x\right)} \cdot \frac{\frac{\cos \left(x \cdot 2\right)}{c}}{s \cdot x}
(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
 (* (/ 1.0 (* c (* s x))) (/ (/ (cos (* x 2.0)) c) (* s x))))
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 (1.0 / (c * (s * x))) * ((cos(x * 2.0) / c) / (s * x));
}

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.7

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

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{\left(c \cdot c\right)} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  3. Applied associate-*l*_binary6423.0

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\color{blue}{c \cdot \left(c \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)\right)}} \]
  4. Applied add-sqr-sqrt_binary6423.1

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

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

    \[\leadsto \frac{\cos \left(2 \cdot x\right)}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \color{blue}{\left(s \cdot \left(c \cdot x\right)\right)}} \]
  7. Applied *-un-lft-identity_binary642.8

    \[\leadsto \frac{\color{blue}{1 \cdot \cos \left(2 \cdot x\right)}}{\left(s \cdot \left(c \cdot x\right)\right) \cdot \left(s \cdot \left(c \cdot x\right)\right)} \]
  8. Applied times-frac_binary642.5

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

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

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

    \[\leadsto \frac{1}{c \cdot \left(s \cdot x\right)} \cdot \color{blue}{\frac{\frac{\cos \left(x \cdot 2\right)}{c}}{s \cdot x}} \]
  12. Final simplification2.6

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

Reproduce

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