Average Error: 0.1 → 0.1
Time: 4.3s
Precision: 64
\[0.0 \le e \le 1\]
\[\frac{e \cdot \sin v}{1 + e \cdot \cos v}\]
\[\left(e \cdot \sin v\right) \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{1 + e \cdot \cos v}\right)\right)\]
\frac{e \cdot \sin v}{1 + e \cdot \cos v}
\left(e \cdot \sin v\right) \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{1 + e \cdot \cos v}\right)\right)
double code(double e, double v) {
	return ((e * sin(v)) / (1.0 + (e * cos(v))));
}
double code(double e, double v) {
	return ((e * sin(v)) * expm1(log1p((1.0 / (1.0 + (e * cos(v)))))));
}

Error

Bits error versus e

Bits error versus v

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[\frac{e \cdot \sin v}{1 + e \cdot \cos v}\]
  2. Using strategy rm
  3. Applied div-inv0.1

    \[\leadsto \color{blue}{\left(e \cdot \sin v\right) \cdot \frac{1}{1 + e \cdot \cos v}}\]
  4. Using strategy rm
  5. Applied expm1-log1p-u0.1

    \[\leadsto \left(e \cdot \sin v\right) \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{1 + e \cdot \cos v}\right)\right)}\]
  6. Final simplification0.1

    \[\leadsto \left(e \cdot \sin v\right) \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{1 + e \cdot \cos v}\right)\right)\]

Reproduce

herbie shell --seed 2020079 +o rules:numerics
(FPCore (e v)
  :name "Trigonometry A"
  :precision binary64
  :pre (<= 0.0 e 1)
  (/ (* e (sin v)) (+ 1 (* e (cos v)))))