baybe.utils.numerical.closer_element

baybe.utils.numerical.closer_element(x: float, y: float, target: float)[source]

Determine which of two given inputs is closer to a target value.

Parameters:
  • x (float) – The first input that should be checked.

  • y (float) – The second input that should be checked.

  • target (float) – The target value.

Return type:

float

Returns:

The closer of the two elements.