lcm_approx(smaller,
larger,
tolerance=0.0,
max_mult=MAX_MULT,
threshold=1.0e-10)
|
|
From the two given numbers return two least common multiples (LCMs)
that are within the specified tolerance of each other. If the numbers are
integers and the tolerance is zero then this function is equivalent to
the traditional LCM and the two returned LCMs will be identical integers.
Raise a ValueError if either integer multiplier is larger than the given
maximum.
- Parameters:
smaller (float) - the smaller number
larger (float) - the larger number
tolerance (float) - a parameter controlling the extent to which two floats may be
considered equivalent
max_mult (int) - the maximum allowable multiplier, supported to avoid potentially
very long loops given that the inputs are floats compared using a
specified tolerance
threshold (float) - a parameter controlling numerical precision
- Returns: tuple, tuple
- the first tuple contains the two LCMs, the second contains the
two integer multipliers, i.e. those integers which when
multiplied by the inputs produce the LCMs
- Raises:
ValueError - if either integer multipler is larger than the given maximum
|