I have a real number $x$ (for concreteness, say $10^4<x<10^6$) and would like to find $e^x-\lfloor e^x\rfloor$ to reasonable precision (10-20 decimal places). What is the most efficient method?
Computing $e^x$ directly in an arbitrary-precision library works but this requires a lot of storage space (and hence time) to store digits that I just throw away. Is there a better approach?
Edit: If it would help I have $x=y+n$ where $y$ is fixed throughout all my calculations (an easily-computed real constant) and $n\in\mathbb{Z}.$ I'd like to do the calculation for a million values of $n$, give or take.
It entirely depends on why this is important and how many values of $x$ are in question. All numerical methods are context dependent.
The standard example is much easier than your task. Take a polynomial in one variable. Write it in the most efficient method, Horner's. Then evaluate it at real numbers, far enough away that fixed length precision gives, essentially, gibberish.
In contrast, if the polynomial has integer coefficients, one may rewrite it as a finite Taylor series around a chosen integer point $n.$ If $|x-n| < 1,$ or better $|x-n| \leq \frac{1}{2}$ by rounding, we now get quite wonderful precision for the polynomial.
The bad news is that the strictly analogous procedure is to save an impossible number of values of $\log m$ for integers $e^{10^4} < m < e^{10^6}.$
So it still comes down to context.