Average Error: 0.1 → 0.2
Time: 17.0s
Precision: 64
\[0 \le e \le 1\]
\[\frac{e \cdot \sin v}{1 + e \cdot \cos v}\]
\[e \cdot \mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\frac{\sin v}{\mathsf{fma}\left(\left(\cos v\right), e, 1\right)}\right)\right)\right)\right)\]
\frac{e \cdot \sin v}{1 + e \cdot \cos v}
e \cdot \mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\frac{\sin v}{\mathsf{fma}\left(\left(\cos v\right), e, 1\right)}\right)\right)\right)\right)
double f(double e, double v) {
        double r644668 = e;
        double r644669 = v;
        double r644670 = sin(r644669);
        double r644671 = r644668 * r644670;
        double r644672 = 1.0;
        double r644673 = cos(r644669);
        double r644674 = r644668 * r644673;
        double r644675 = r644672 + r644674;
        double r644676 = r644671 / r644675;
        return r644676;
}

double f(double e, double v) {
        double r644677 = e;
        double r644678 = v;
        double r644679 = sin(r644678);
        double r644680 = cos(r644678);
        double r644681 = 1.0;
        double r644682 = fma(r644680, r644677, r644681);
        double r644683 = r644679 / r644682;
        double r644684 = log1p(r644683);
        double r644685 = expm1(r644684);
        double r644686 = r644677 * r644685;
        return r644686;
}

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}{\mathsf{fma}\left(\left(\cos v\right), e, 1\right)} \cdot \sin v}\]
  3. Using strategy rm
  4. Applied div-inv0.1

    \[\leadsto \color{blue}{\left(e \cdot \frac{1}{\mathsf{fma}\left(\left(\cos v\right), e, 1\right)}\right)} \cdot \sin v\]
  5. Applied associate-*l*0.1

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

    \[\leadsto e \cdot \color{blue}{\frac{\sin v}{\mathsf{fma}\left(\left(\cos v\right), e, 1\right)}}\]
  7. Using strategy rm
  8. Applied expm1-log1p-u0.2

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

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

Reproduce

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