Average Error: 0.1 → 0.2
Time: 16.3s
Precision: 64
\[0.0 \le e \le 1\]
\[\frac{e \cdot \sin v}{1 + e \cdot \cos v}\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(e \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\sin v}{\mathsf{fma}\left(\cos v, e, 1\right)}\right)\right)\right)\right)\]
\frac{e \cdot \sin v}{1 + e \cdot \cos v}
\mathsf{log1p}\left(\mathsf{expm1}\left(e \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\sin v}{\mathsf{fma}\left(\cos v, e, 1\right)}\right)\right)\right)\right)
double f(double e, double v) {
        double r963343 = e;
        double r963344 = v;
        double r963345 = sin(r963344);
        double r963346 = r963343 * r963345;
        double r963347 = 1.0;
        double r963348 = cos(r963344);
        double r963349 = r963343 * r963348;
        double r963350 = r963347 + r963349;
        double r963351 = r963346 / r963350;
        return r963351;
}

double f(double e, double v) {
        double r963352 = e;
        double r963353 = v;
        double r963354 = sin(r963353);
        double r963355 = cos(r963353);
        double r963356 = 1.0;
        double r963357 = fma(r963355, r963352, r963356);
        double r963358 = r963354 / r963357;
        double r963359 = expm1(r963358);
        double r963360 = log1p(r963359);
        double r963361 = r963352 * r963360;
        double r963362 = expm1(r963361);
        double r963363 = log1p(r963362);
        return r963363;
}

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

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

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

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

Reproduce

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