Average Error: 0.1 → 0.1
Time: 4.0s
Precision: binary64
\[0 \leq e \land e \leq 1\]
\[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(e \cdot \frac{\sin v}{\mathsf{fma}\left(e, \cos v, 1\right)}\right)\right) \]
(FPCore (e v) :precision binary64 (/ (* e (sin v)) (+ 1.0 (* e (cos v)))))
(FPCore (e v)
 :precision binary64
 (expm1 (log1p (* e (/ (sin v) (fma e (cos v) 1.0))))))
double code(double e, double v) {
	return (e * sin(v)) / (1.0 + (e * cos(v)));
}
double code(double e, double v) {
	return expm1(log1p((e * (sin(v) / fma(e, cos(v), 1.0)))));
}
function code(e, v)
	return Float64(Float64(e * sin(v)) / Float64(1.0 + Float64(e * cos(v))))
end
function code(e, v)
	return expm1(log1p(Float64(e * Float64(sin(v) / fma(e, cos(v), 1.0)))))
end
code[e_, v_] := N[(N[(e * N[Sin[v], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(e * N[Cos[v], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[e_, v_] := N[(Exp[N[Log[1 + N[(e * N[(N[Sin[v], $MachinePrecision] / N[(e * N[Cos[v], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]
\frac{e \cdot \sin v}{1 + e \cdot \cos v}
\mathsf{expm1}\left(\mathsf{log1p}\left(e \cdot \frac{\sin v}{\mathsf{fma}\left(e, \cos v, 1\right)}\right)\right)

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. Applied egg-rr0.9

    \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(e, \cos v, 1\right)}{e \cdot \sin v}\right)}^{-1}} \]
  3. Applied egg-rr0.3

    \[\leadsto \color{blue}{\frac{e}{\frac{\mathsf{fma}\left(e, \cos v, 1\right)}{\sin v}}} \]
  4. Applied egg-rr0.1

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

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

Reproduce

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