<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_float(s, default=0.0, allow_nan=False):
 """ Return input converted into a float. If failed, then return ``default``. Note that, by default, ``allow_nan=False``, so ``to_float`` will not return ``nan``, ``inf``, or ``-inf``. Examples:: 1.5 1.0 0.0 0.0 0.0 -inf 0.0 0.0 'Empty' """

    try:
        f = float(s)
    except (TypeError, ValueError):
        return default
    if not allow_nan:
        if f != f or f in _infs:
            return default
    return f