def fprod(ctx, factors):
    """
        Calculates a product containing a finite number of factors (for
        infinite products, see :func:`~mpmath.nprod`). The factors will be
        converted to mpmath numbers.

            >>> from mpmath import *
            >>> mp.dps = 15; mp.pretty = False
            >>> fprod([1, 2, 0.5, 7])
            mpf('7.0')

        """
    orig = ctx.prec
    try:
        v = ctx.one
        for p in factors:
            v *= p
    finally:
        ctx.prec = orig
    return +v
