


def 		snake_case_   (				lowercase__     :    int       ,     lowercase__     :    int = 10_00     ):






				'''simple docstring'''






				if (not isinstance(lowercase__       ,     lowercase__     )) or (digit_position <= 0):
								raise ValueError("""Digit position must be a positive integer"""     )
				elif (not isinstance(lowercase__       ,     lowercase__     )) or (precision < 0):
								raise ValueError("""Precision must be a nonnegative integer"""     )

				# compute an approximation of (16 ** (n - 1)) * pi whose fractional part is mostly
				# accurate
				_lowerCAmelCase  						=(
				    4 * _subsum(lowercase__       ,     1       ,     lowercase__     )
				    - 2 * _subsum(lowercase__       ,     4       ,     lowercase__     )
				    - _subsum(lowercase__       ,     5       ,     lowercase__     )
				    - _subsum(lowercase__       ,     6       ,     lowercase__     )
				)

				# return the first hex digit of the fractional part of the result
				return hex(int((sum_result % 1) * 16     )     )[2:]

def 		snake_case_   (				lowercase__     :    int       ,     lowercase__     :    int       ,     lowercase__     :    int     ):






				'''simple docstring'''






				_lowerCAmelCase  						=0.0
				for sum_index in range(digit_pos_to_extract + precision     ):
								_lowerCAmelCase  						=8 * sum_index + denominator_addend
								if sum_index < digit_pos_to_extract:
												# if the exponential term is an integer and we mod it by the denominator
												# before dividing, only the integer part of the sum will change;
												# the fractional part will not
												_lowerCAmelCase  						=pow(
												    16       ,     digit_pos_to_extract - 1 - sum_index       ,     lowercase__     )
								else:
												_lowerCAmelCase  						=pow(16       ,     digit_pos_to_extract - 1 - sum_index     )
								total += exponential_term / denominator
				return total


if __name__ == "__main__":
		import doctest

		doctest.testmod()





from typing import TYPE_CHECKING

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


__SCREAMING_SNAKE_CASE	:							str           =  {
    '''configuration_ernie_m''': ['''ERNIE_M_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ErnieMConfig'''],
}

try:
		if not is_sentencepiece_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__SCREAMING_SNAKE_CASE	:							Any           =  ['''ErnieMTokenizer''']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__SCREAMING_SNAKE_CASE	:							Tuple           =  [
		    '''ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''ErnieMForMultipleChoice''',
		    '''ErnieMForQuestionAnswering''',
		    '''ErnieMForSequenceClassification''',
		    '''ErnieMForTokenClassification''',
		    '''ErnieMModel''',
		    '''ErnieMPreTrainedModel''',
		    '''ErnieMForInformationExtraction''',
		]


if TYPE_CHECKING:
		from .configuration_ernie_m import ERNIE_M_PRETRAINED_CONFIG_ARCHIVE_MAP, ErnieMConfig

		try:
				if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_ernie_m import ErnieMTokenizer

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_ernie_m import (
				    ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST,
				    ErnieMForInformationExtraction,
				    ErnieMForMultipleChoice,
				    ErnieMForQuestionAnswering,
				    ErnieMForSequenceClassification,
				    ErnieMForTokenClassification,
				    ErnieMModel,
				    ErnieMPreTrainedModel,
				)


else:
		import sys

		__SCREAMING_SNAKE_CASE	:							str           =  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)

