"""simple docstring"""







def   a__      (		UpperCAmelCase__       :			float		,			UpperCAmelCase__       :			float		,			UpperCAmelCase__       :			float			)->	list[int]:
						if hue < 0 or hue > 3_6_0:
												raise Exception("""hue should be between 0 and 360"""			)

						if saturation < 0 or saturation > 1:
												raise Exception("""saturation should be between 0 and 1"""			)

						if value < 0 or value > 1:
												raise Exception("""value should be between 0 and 1"""			)

						UpperCAmelCase__						=		value * saturation
						UpperCAmelCase__						=		hue / 6_0
						UpperCAmelCase__						=		chroma * (1 - abs(hue_section % 2 - 1			))
						UpperCAmelCase__						=		value - chroma

						if hue_section >= 0 and hue_section <= 1:
												UpperCAmelCase__						=		round(2_5_5 * (chroma + match_value)			)
												UpperCAmelCase__						=		round(2_5_5 * (second_largest_component + match_value)			)
												UpperCAmelCase__						=		round(2_5_5 * (match_value)			)
						elif hue_section > 1 and hue_section <= 2:
												UpperCAmelCase__						=		round(2_5_5 * (second_largest_component + match_value)			)
												UpperCAmelCase__						=		round(2_5_5 * (chroma + match_value)			)
												UpperCAmelCase__						=		round(2_5_5 * (match_value)			)
						elif hue_section > 2 and hue_section <= 3:
												UpperCAmelCase__						=		round(2_5_5 * (match_value)			)
												UpperCAmelCase__						=		round(2_5_5 * (chroma + match_value)			)
												UpperCAmelCase__						=		round(2_5_5 * (second_largest_component + match_value)			)
						elif hue_section > 3 and hue_section <= 4:
												UpperCAmelCase__						=		round(2_5_5 * (match_value)			)
												UpperCAmelCase__						=		round(2_5_5 * (second_largest_component + match_value)			)
												UpperCAmelCase__						=		round(2_5_5 * (chroma + match_value)			)
						elif hue_section > 4 and hue_section <= 5:
												UpperCAmelCase__						=		round(2_5_5 * (second_largest_component + match_value)			)
												UpperCAmelCase__						=		round(2_5_5 * (match_value)			)
												UpperCAmelCase__						=		round(2_5_5 * (chroma + match_value)			)
						else:
												UpperCAmelCase__						=		round(2_5_5 * (chroma + match_value)			)
												UpperCAmelCase__						=		round(2_5_5 * (match_value)			)
												UpperCAmelCase__						=		round(2_5_5 * (second_largest_component + match_value)			)

						return [red, green, blue]


def   a__      (		UpperCAmelCase__       :			int		,			UpperCAmelCase__       :			int		,			UpperCAmelCase__       :			int			)->	list[float]:
						if red < 0 or red > 2_5_5:
												raise Exception("""red should be between 0 and 255"""			)

						if green < 0 or green > 2_5_5:
												raise Exception("""green should be between 0 and 255"""			)

						if blue < 0 or blue > 2_5_5:
												raise Exception("""blue should be between 0 and 255"""			)

						UpperCAmelCase__						=		red / 2_5_5
						UpperCAmelCase__						=		green / 2_5_5
						UpperCAmelCase__						=		blue / 2_5_5
						UpperCAmelCase__						=		max(UpperCAmelCase__		,			UpperCAmelCase__		,			UpperCAmelCase__			)
						UpperCAmelCase__						=		value - min(UpperCAmelCase__		,			UpperCAmelCase__		,			UpperCAmelCase__			)
						UpperCAmelCase__						=		0 if value == 0 else chroma / value

						if chroma == 0:
												UpperCAmelCase__						=		0.0
						elif value == float_red:
												UpperCAmelCase__						=		6_0 * (0 + (float_green - float_blue) / chroma)
						elif value == float_green:
												UpperCAmelCase__						=		6_0 * (2 + (float_blue - float_red) / chroma)
						else:
												UpperCAmelCase__						=		6_0 * (4 + (float_red - float_green) / chroma)

						UpperCAmelCase__						=		(hue + 3_6_0) % 3_6_0

						return [hue, saturation, value]







def   a__      (		UpperCAmelCase__       :			list[float]		,			UpperCAmelCase__       :			list[float]			)->	bool:
						UpperCAmelCase__						=		abs(hsv_a[0] - hsv_a[0]			) < 0.2
						UpperCAmelCase__						=		abs(hsv_a[1] - hsv_a[1]			) < 0.0_02
						UpperCAmelCase__						=		abs(hsv_a[2] - hsv_a[2]			) < 0.0_02

						return check_hue and check_saturation and check_value


"""simple docstring"""







import math
from timeit import timeit


def   a__      (		UpperCAmelCase__       :			int			)->	int:
						UpperCAmelCase__						=		0
						UpperCAmelCase__						=		abs(UpperCAmelCase__			)
						while True:
												UpperCAmelCase__						=		n // 1_0
												digits += 1
												if n == 0:
																		break
						return digits


def   a__      (		UpperCAmelCase__       :			int			)->	int:
						return 1 if n == 0 else math.floor(math.log(abs(UpperCAmelCase__			)		,			1_0			) + 1			)


def   a__      (		UpperCAmelCase__       :			int			)->	int:
						return len(str(abs(UpperCAmelCase__			)			)			)


def   a__      (		)->	None:
						from collections.abc import Callable

						def benchmark_a_function(UpperCAmelCase__       :			Callable		,			UpperCAmelCase__       :			int			) -> None:
												UpperCAmelCase__						=		f'{func.__name__}({value})'
												UpperCAmelCase__						=		timeit(f'__main__.{call}'		,			setup="""import __main__"""			)
												print(f'{call}: {func(UpperCAmelCase__			)} -- {timing} seconds'			)

						for value in (2_6_2_1_4_4, 1_1_2_5_8_9_9_9_0_6_8_4_2_6_2_4, 1_2_6_7_6_5_0_6_0_0_2_2_8_2_2_9_4_0_1_4_9_6_7_0_3_2_0_5_3_7_6):
												for func in (num_digits, num_digits_fast, num_digits_faster):
																		benchmark_a_function(UpperCAmelCase__		,			UpperCAmelCase__			)
												print()


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						benchmark()

