Average Error: 0.1 → 0.2
Time: 6.0s
Precision: binary64
\[0 \leq e \land e \leq 1\]
\[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
\[\begin{array}{l} t_0 := \sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}\\ \frac{e}{t_0} \cdot \frac{\sin v}{t_0} \end{array} \]
\frac{e \cdot \sin v}{1 + e \cdot \cos v}
\begin{array}{l}
t_0 := \sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}\\
\frac{e}{t_0} \cdot \frac{\sin v}{t_0}
\end{array}
(FPCore (e v) :precision binary64 (/ (* e (sin v)) (+ 1.0 (* e (cos v)))))
(FPCore (e v)
 :precision binary64
 (let* ((t_0 (sqrt (fma e (cos v) 1.0)))) (* (/ e t_0) (/ (sin v) t_0))))
double code(double e, double v) {
	return (e * sin(v)) / (1.0 + (e * cos(v)));
}
double code(double e, double v) {
	double t_0 = sqrt(fma(e, cos(v), 1.0));
	return (e / t_0) * (sin(v) / t_0);
}

Error

Bits error versus e

Bits error versus v

Derivation

  1. Initial program 0.1

    \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
  2. Simplified0.1

    \[\leadsto \color{blue}{\frac{e \cdot \sin v}{\mathsf{fma}\left(e, \cos v, 1\right)}} \]
  3. Applied add-sqr-sqrt_binary640.2

    \[\leadsto \frac{e \cdot \sin v}{\color{blue}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)} \cdot \sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}}} \]
  4. Applied times-frac_binary640.2

    \[\leadsto \color{blue}{\frac{e}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}} \cdot \frac{\sin v}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}}} \]
  5. Applied clear-num_binary640.2

    \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}}{e}}} \cdot \frac{\sin v}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}} \]
  6. Applied *-un-lft-identity_binary640.2

    \[\leadsto \frac{1}{\frac{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}}{\color{blue}{1 \cdot e}}} \cdot \frac{\sin v}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}} \]
  7. Applied *-un-lft-identity_binary640.2

    \[\leadsto \frac{1}{\frac{\sqrt{\color{blue}{1 \cdot \mathsf{fma}\left(e, \cos v, 1\right)}}}{1 \cdot e}} \cdot \frac{\sin v}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}} \]
  8. Applied sqrt-prod_binary640.2

    \[\leadsto \frac{1}{\frac{\color{blue}{\sqrt{1} \cdot \sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}}}{1 \cdot e}} \cdot \frac{\sin v}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}} \]
  9. Applied times-frac_binary640.2

    \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}}{e}}} \cdot \frac{\sin v}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}} \]
  10. Applied add-cube-cbrt_binary640.2

    \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}}{e}} \cdot \frac{\sin v}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}} \]
  11. Applied times-frac_binary640.2

    \[\leadsto \color{blue}{\left(\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{\sqrt{1}}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}}{e}}\right)} \cdot \frac{\sin v}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}} \]
  12. Simplified0.2

    \[\leadsto \left(\color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}}{e}}\right) \cdot \frac{\sin v}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}} \]
  13. Simplified0.2

    \[\leadsto \left(1 \cdot \color{blue}{\frac{e}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}}}\right) \cdot \frac{\sin v}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}} \]
  14. Final simplification0.2

    \[\leadsto \frac{e}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}} \cdot \frac{\sin v}{\sqrt{\mathsf{fma}\left(e, \cos v, 1\right)}} \]

Reproduce

herbie shell --seed 2022088 
(FPCore (e v)
  :name "Trigonometry A"
  :precision binary64
  :pre (and (<= 0.0 e) (<= e 1.0))
  (/ (* e (sin v)) (+ 1.0 (* e (cos v)))))