



'''simple docstring'''





def   a_   (		_UpperCAmelCase    :      int | float | str				)    ->  tuple[int, int]:
      try:
            __snake_case :   Tuple													=    float(_UpperCAmelCase				)
      except ValueError:
            raise ValueError('Please enter a valid number'				)
      __snake_case :   Optional[Any]													=    decimal - int(_UpperCAmelCase				)
      if fractional_part == 0:
            return int(_UpperCAmelCase				), 1
      else:
            __snake_case :   int													=    len(str(_UpperCAmelCase				).split('.'				)[1]				)
            __snake_case :   Tuple													=    int(decimal * (10**number_of_frac_digits)				)
            __snake_case :   Optional[int]													=    10**number_of_frac_digits
            __snake_case							,     __snake_case :   Tuple													=    denominator, numerator
            while True:
                  __snake_case :   Tuple													=    dividend % divisor
                  if remainder == 0:
                        break
                  __snake_case							,     __snake_case :   Optional[Any]													=    divisor, remainder
            __snake_case							,     __snake_case :   Any													=    numerator / divisor, denominator / divisor
            return int(_UpperCAmelCase				), int(_UpperCAmelCase				)


if __name__ == "__main__":
    print(F"""{decimal_to_fraction(2) = }""")
    print(F"""{decimal_to_fraction(89.0) = }""")
    print(F"""{decimal_to_fraction("67") = }""")
    print(F"""{decimal_to_fraction("45.0") = }""")
    print(F"""{decimal_to_fraction(1.5) = }""")
    print(F"""{decimal_to_fraction("6.25") = }""")
    print(F"""{decimal_to_fraction("78td") = }""")








'''simple docstring'''





from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


A__    :   List[str]           =					{
    '''configuration_autoformer''': [
        '''AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''AutoformerConfig''',
    ],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    A__    :   Optional[Any]           =					[
        '''AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
        '''AutoformerForPrediction''',
        '''AutoformerModel''',
        '''AutoformerPreTrainedModel''',
    ]


if TYPE_CHECKING:
    from .configuration_autoformer import (
        AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
        AutoformerConfig,
    )

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_autoformer import (
            AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
            AutoformerForPrediction,
            AutoformerModel,
            AutoformerPreTrainedModel,
        )

else:
    import sys

    A__    :   Optional[int]           =					_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



