

"""simple docstring"""






def  UpperCamelCase   (     _lowerCAmelCase       :  int,					_lowerCAmelCase       :  int = 1000	)			->     str:
	if (not isinstance(_lowerCAmelCase,					_lowerCAmelCase	)) or (digit_position <= 0):
		raise ValueError("""Digit position must be a positive integer"""	)
	elif (not isinstance(_lowerCAmelCase,					_lowerCAmelCase	)) 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
	_UpperCAmelCase      :							Tuple       =   (
	    4 * _subsum(_lowerCAmelCase,					1,					_lowerCAmelCase	)
	    - 2 * _subsum(_lowerCAmelCase,					4,					_lowerCAmelCase	)
	    - _subsum(_lowerCAmelCase,					5,					_lowerCAmelCase	)
	    - _subsum(_lowerCAmelCase,					6,					_lowerCAmelCase	)
	)

	# return the first hex digit of the fractional part of the result
	return hex(int((sum_result % 1) * 16	)	)[2:]
def  UpperCamelCase   (     _lowerCAmelCase       :  int,					_lowerCAmelCase       :  int,					_lowerCAmelCase       :  int	)			->     float:
	_UpperCAmelCase      :							Union[str, Any]       =   0.0
	for sum_index in range(digit_pos_to_extract + precision	):
		_UpperCAmelCase      :							str       =   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
			_UpperCAmelCase      :							str       =   pow(
			    16,					digit_pos_to_extract - 1 - sum_index,					_lowerCAmelCase	)
		else:
			_UpperCAmelCase      :							Optional[Any]       =   pow(16,					digit_pos_to_extract - 1 - sum_index	)
		total += exponential_term / denominator
	return total


if __name__ == "__main__":
						import doctest

						doctest.testmod()








"""simple docstring"""






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCamelCase__			:					int							  =					{'''configuration_qdqbert''': ['''QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''QDQBertConfig''']}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCamelCase__			:					Optional[int]							  =					[
						    '''QDQBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''QDQBertForMaskedLM''',
						    '''QDQBertForMultipleChoice''',
						    '''QDQBertForNextSentencePrediction''',
						    '''QDQBertForQuestionAnswering''',
						    '''QDQBertForSequenceClassification''',
						    '''QDQBertForTokenClassification''',
						    '''QDQBertLayer''',
						    '''QDQBertLMHeadModel''',
						    '''QDQBertModel''',
						    '''QDQBertPreTrainedModel''',
						    '''load_tf_weights_in_qdqbert''',
						]


if TYPE_CHECKING:
						from .configuration_qdqbert import QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, QDQBertConfig

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_qdqbert import (
												    QDQBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
												    QDQBertForMaskedLM,
												    QDQBertForMultipleChoice,
												    QDQBertForNextSentencePrediction,
												    QDQBertForQuestionAnswering,
												    QDQBertForSequenceClassification,
												    QDQBertForTokenClassification,
												    QDQBertLayer,
												    QDQBertLMHeadModel,
												    QDQBertModel,
												    QDQBertPreTrainedModel,
												    load_tf_weights_in_qdqbert,
												)


else:
						import sys

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





