Average Error: 21.3 → 1.7
Time: 6.7s
Precision: binary64
\[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
\[\begin{array}{l} t_0 := c \cdot \left|x \cdot s\right|\\ \frac{\frac{\cos \left(2 \cdot x\right)}{t_0}}{t_0} \end{array} \]
\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)}
\begin{array}{l}
t_0 := c \cdot \left|x \cdot s\right|\\
\frac{\frac{\cos \left(2 \cdot x\right)}{t_0}}{t_0}
\end{array}
(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
 (let* ((t_0 (* c (fabs (* x s))))) (/ (/ (cos (* 2.0 x)) t_0) t_0)))
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) {
	double t_0 = c * fabs(x * s);
	return (cos(2.0 * x) / t_0) / t_0;
}

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 21.3

    \[\frac{\cos \left(2 \cdot x\right)}{{c}^{2} \cdot \left(\left(x \cdot {s}^{2}\right) \cdot x\right)} \]
  2. Applied add-sqr-sqrt_binary6421.3

    \[\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)}} \]
  3. Simplified21.3

    \[\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)} \]
  4. Simplified14.5

    \[\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)} \]
  5. Applied pow2_binary6414.5

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

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

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

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

    \[\leadsto \color{blue}{{\left(\frac{\frac{\cos \left(2 \cdot x\right)}{c \cdot \left|s \cdot x\right|}}{c \cdot \left|s \cdot x\right|}\right)}^{1}} \]
  10. Final simplification1.7

    \[\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 2022067 
(FPCore (x c s)
  :name "mixedcos"
  :precision binary64
  (/ (cos (* 2.0 x)) (* (pow c 2.0) (* (* x (pow s 2.0)) x))))