code: def floats(
      min_value: Optional[Real] = None,
      max_value: Optional[Real] = None,
      *,
      allow_nan: Optional[bool] = None,
      allow_infinity: Optional[bool] = None,
      allow_subnormal: Optional[bool] = None,
      width: Literal[16, 32, 64] = 64,
      exclude_min: bool = False,
      exclude_max: bool = False,
  ) -> SearchStrategy[float]:
      """Returns a strategy which generates floats.
  
      - If min_value is not None, all values will be ``>= min_value``
        (or ``> min_value`` if ``exclude_min``).
      - If max_value is not None, all values will be ``<= max_value``
        (or ``< max_value`` if ``exclude_max``).
      - If min_value or max_value is not None, it is an error to enable
        allow_nan.
      - If both min_value and max_value are not None, it is an error to enable
        allow_infinity.
      - If inferred values range does not include subnormal values, it is an error
        to enable allow_subnormal.
  
      Where not explicitly ruled out by the bounds,
      :wikipedia:`subnormals <Subnormal_number>`, infinities, and NaNs are possible
      values generated by this strategy.
  
      The width argument specifies the maximum number of bits of precision
      required to represent the generated float. Valid values are 16, 32, or 64.
      Passing ``width=32`` will still use the builtin 64-bit :class:`~python:float` class,
      but always for values which can be exactly represented as a 32-bit float.
  
      The exclude_min and exclude_max argument can be used to generate numbers
      from open or half-open intervals, by excluding the respective endpoints.
      Excluding either signed zero will also exclude the other.
      Attempting to exclude an endpoint which is None will raise an error;
      use ``allow_infinity=False`` to generate finite floats.  You can however
      use e.g. ``min_value=-math.inf, exclude_min=True`` to exclude only
      one infinite endpoint.
  
      Examples from this strategy have a complicated and hard to explain
      shrinking behaviour, but it tries to improve "human readability". Finite
      numbers will be preferred to infinity and infinity will be preferred to
      NaN.
      """
      check_type(bool, exclude_min, "exclude_min")
      check_type(bool, exclude_max, "exclude_max")
  
      if allow_nan is None:
          allow_nan = bool(min_value is None and max_value is None)
      elif allow_nan and (
          min_value is not None or max_value is not None
      ):
          raise InvalidArgument(
              f"Cannot have {allow_nan=}, with min_value or max_value"
          )
  
      if width not in (16, 32, 64):
          raise InvalidArgument(
              f"Got {width=}, but the only valid values "
              "are the integers 16, 32, and 64."
          )
  
      check_valid_bound(min_value, "min_value")
      check_valid_bound(max_value, "max_value")
  
      if math.copysign(1.0, -0.0) == 1.0:  # pragma: no cover
          raise FloatingPointError(
              "Your Python install can't represent -0.0, which is required by the "
              "IEEE-754 floating-point specification.  This is probably because it was "
              "compiled with an unsafe option like -ffast-math; for a more detailed "
              "explanation see https://simonbyrne.github.io/notes/fastmath/"
          )
      if (
          allow_subnormal and next_up(0.0, width=width) == 0
      ):  # pragma: no cover
          # Not worth having separate CI envs and dependencies just to cover this branch;
          # discussion in https://github.com/HypothesisWorks/hypothesis/issues/3092
          #
          # Erroring out here ensures that the database contents are interpreted
          # consistently - which matters for such a foundational strategy, even if it's
          # not always true for all user-composed strategies further up the stack.
          from _hypothesis_ftz_detector import identify_ftz_culprits
  
          try:
              ftz_pkg = identify_ftz_culprits()
          except Exception:
              ftz_pkg = None
          if ftz_pkg:
              ftz_msg = (
                  f"This seems to be because the `{ftz_pkg}` package was compiled with "
                  f"-ffast-math or a similar option, which sets global processor state "
                  f"- see https://simonbyrne.github.io/notes/fastmath/ for details.  "
                  f"If you don't know why {ftz_pkg} is installed, `pipdeptree -rp "
                  f"{ftz_pkg}` will show which packages depend on it."
              )
          else:
              ftz_msg = (
                  "This is usually because something was compiled with -ffast-math "
                  "or a similar option, which sets global processor state.  See "
                  "https://simonbyrne.github.io/notes/fastmath/ for a more detailed "
                  "writeup - and good luck!"
              )
          raise FloatingPointError(
              f"Got {allow_subnormal=}, but we can't represent "
              f"subnormal floats right now, in violation of the IEEE-754 floating-point "
              f"specification.  {ftz_msg}"
          )
  
      min_arg, max_arg = min_value, max_value
      if min_value is not None:
          min_value = float_of(min_value, width)
          assert isinstance(min_value, float)
      if max_value is not None:
          max_value = float_of(max_value, width)
          assert isinstance(max_value, float)
  
      if min_value != min_arg:
          raise InvalidArgument(
              f"min_value={min_arg!r} cannot be exactly represented as a float "
              f"of width {width} - use {min_value=} instead."
          )
      if max_value != max_arg:
          raise InvalidArgument(
              f"max_value={max_arg!r} cannot be exactly represented as a float "
              f"of width {width} - use {max_value=} instead."
          )
  
      if exclude_min and (min_value is None or min_value == math.inf):
          raise InvalidArgument(f"Cannot exclude {min_value=}")
      if exclude_max and (max_value is None or max_value == -math.inf):
          raise InvalidArgument(f"Cannot exclude {max_value=}")
  
      assumed_allow_subnormal = (
          allow_subnormal is None or allow_subnormal
      )
      if min_value is not None and (
          exclude_min or (min_arg is not None and min_value < min_arg)
      ):
          min_value = next_up_normal(
              min_value, width, assumed_allow_subnormal
          )
          if min_value == min_arg:
              assert min_value == min_arg == 0
              assert is_negative(min_arg)
              assert not is_negative(min_value)
              min_value = next_up_normal(
                  min_value, width, assumed_allow_subnormal
              )
          assert min_value > min_arg  # type: ignore
      if max_value is not None and (
          exclude_max or (max_arg is not None and max_value > max_arg)
      ):
          max_value = next_down_normal(
              max_value, width, assumed_allow_subnormal
          )
          if max_value == max_arg:
              assert max_value == max_arg == 0
              assert is_negative(max_value)
              assert not is_negative(max_arg)
              max_value = next_down_normal(
                  max_value, width, assumed_allow_subnormal
              )
          assert max_value < max_arg  # type: ignore
  
      if min_value == -math.inf:
          min_value = None
      if max_value == math.inf:
          max_value = None
  
      bad_zero_bounds = (
          min_value == max_value == 0
          and is_negative(max_value)
          and not is_negative(min_value)
      )
      if (
          min_value is not None
          and max_value is not None
          and (min_value > max_value or bad_zero_bounds)
      ):
          # This is a custom alternative to check_valid_interval, because we want
          # to include the bit-width and exclusion information in the message.
          msg = (
              "There are no %s-bit floating-point values between min_value=%r "
              "and max_value=%r" % (width, min_arg, max_arg)
          )
          if exclude_min or exclude_max:
              msg += f", {exclude_min=} and {exclude_max=}"
          raise InvalidArgument(msg)
  
      if allow_infinity is None:
          allow_infinity = bool(min_value is None or max_value is None)
      elif allow_infinity:
          if min_value is not None and max_value is not None:
              raise InvalidArgument(
                  f"Cannot have {allow_infinity=}, with both min_value and max_value"
              )
      elif min_value == math.inf:
          if min_arg == math.inf:
              raise InvalidArgument(
                  "allow_infinity=False excludes min_value=inf"
              )
          raise InvalidArgument(
              f"exclude_min=True turns min_value={min_arg!r} into inf, "
              "but allow_infinity=False"
          )
      elif max_value == -math.inf:
          if max_arg == -math.inf:
              raise InvalidArgument(
                  "allow_infinity=False excludes max_value=-inf"
              )
          raise InvalidArgument(
              f"exclude_max=True turns max_value={max_arg!r} into -inf, "
              "but allow_infinity=False"
          )
  
      smallest_normal = width_smallest_normals[width]
      if allow_subnormal is None:
          if min_value is not None and max_value is not None:
              if min_value == max_value:
                  allow_subnormal = (
                      -smallest_normal < min_value < smallest_normal
                  )
              else:
                  allow_subnormal = (
                      min_value < smallest_normal
                      and max_value > -smallest_normal
                  )
          elif min_value is not None:
              allow_subnormal = min_value < smallest_normal
          elif max_value is not None:
              allow_subnormal = max_value > -smallest_normal
          else:
              allow_subnormal = True
      if allow_subnormal:
          if min_value is not None and min_value >= smallest_normal:
              raise InvalidArgument(
                  f"allow_subnormal=True, but minimum value {min_value} "
                  f"excludes values below float{width}'s "
                  f"smallest positive normal {smallest_normal}"
              )
          if max_value is not None and max_value <= -smallest_normal:
              raise InvalidArgument(
                  f"allow_subnormal=True, but maximum value {max_value} "
                  f"excludes values above float{width}'s "
                  f"smallest negative normal {-smallest_normal}"
              )
  
      if min_value is None:
          min_value = float("-inf")
      if max_value is None:
          max_value = float("inf")
      if not allow_infinity:
          min_value = max(min_value, next_up(float("-inf")))
          max_value = min(max_value, next_down(float("inf")))
      assert isinstance(min_value, float)
      assert isinstance(max_value, float)
      smallest_nonzero_magnitude = (
          SMALLEST_SUBNORMAL if allow_subnormal else smallest_normal
      )
      result: SearchStrategy = FloatStrategy(
          min_value=min_value,
          max_value=max_value,
          allow_nan=allow_nan,
          smallest_nonzero_magnitude=smallest_nonzero_magnitude,
      )
  
      if width < 64:
  
          def downcast(x):
              try:
                  return float_of(x, width)
              except OverflowError:  # pragma: no cover
                  reject()
  
          result = result.map(downcast)
      return result
  
imports: import math
  from decimal import Decimal
  from fractions import Fraction
  from typing import Literal, Optional, Union
  from hypothesis.control import reject
  from hypothesis.errors import InvalidArgument
  from hypothesis.internal.filtering import get_float_predicate_bounds, get_integer_predicate_bounds
  from hypothesis.internal.floats import SMALLEST_SUBNORMAL, float_of, float_to_int, int_to_float, is_negative, next_down, next_down_normal, next_up, next_up_normal, width_smallest_normals
  from hypothesis.internal.validation import check_type, check_valid_bound, check_valid_interval
  from hypothesis.strategies._internal.misc import nothing
  from hypothesis.strategies._internal.strategies import SampledFromStrategy, SearchStrategy
  from hypothesis.strategies._internal.utils import cacheable, defines_strategy
label_desc: Use image node_id 2 for calling a global function with example usage: floats(min_value, max_value) and returns: result, float_of