You're seeing just the function within, go back to Cldr.Math module for more information.


within(number(), integer() | Range.t()) :: boolean()

Check if a number is within a range.

  • number is either an integer or a float.

When an integer, the comparison is made using the standard Elixir in operator.

When number is a float the comparison is made using the >= and <= operators on the range endpoints. Note the comparison for a float is only for floats that have no fractional part. If a float has a fractional part then within returns false.

Since this function is only provided to support plural rules, the float comparison is only useful if the float has no fractional part.


iex> Cldr.Math.within(2.0, 1..3)

iex> Cldr.Math.within(2.1, 1..3)