def parse_number_auto_dtype(x):
    """Parse number from string with automatic type detection.

    Parses input string and converts to a number using automatic type detection. If the number contains any
    fractional parts, then the number will be converted to float, otherwise the number will be converted to an int.

    See :ref:`user-guide:int` and :ref:`user-guide:double` for more information on the format.

    Parameters
    ----------
    x : :class:`str`
        String representation of number

    Returns
    -------
    result : :class:`int` or :class:`float`
        Number parsed from :obj:`x` string
    """
    value = float(x)
    if value.is_integer():
        value = int(value)
    return value
