# Integer solutions to combinations of floating point numbers [closed]

Imagine two kids each sitting in the center of their own tilt-a whirl®, each holding steady a flashlight (or laser) whose beam is parallel to the deck. Each machine rotates and precesses (we'll leave out nutation) at different, real, rates. How do we determine the least number of rotations to alignment, for each kid.

If you prefer another analogy: Saturn and Jupiter orbit with different (real) periods. How many orbits for each until conjunction in precisely the same position in space? Simplify by assuming circular, observer-centric, orbits.

specifically solutions to:

aC1 + bC2 = N

where a, b, N are positive integers of your own choosing and C1, C2 are constant, unique, positive, non-integer(real) numbers where C1 < C2.

I am hoping to avoid rigorous computational methods involving modulus tests.

Hope I clarified the ambiguities.

Thanks, @DonThousand the Bezout identity looks interesting.

• Floating point numbers are rational. Thus, the question becomes solving $$\frac{ap}q+\frac{br}s=N\to ap+br=qsN$$where all variables are integers. Thus, the problem is equivalent to solving $aq+br=N$. This is the subject of Bezout's lemma. – Don Thousand Jun 10 at 17:06
• Are the operations of multiplication and addition supposed to be floating point operations? If so, with which rounding convention? – plop Jun 10 at 17:08
• If your goal is implementing something, then probably your are interested in algorithms like Bresenham's algorithm. – plop Jun 10 at 17:14
• Since all floating point numbers are dyadic rationals, there is always a solution with $a$ and $b$ being powers of $2$. If the multiplication and addition operations are taken as exact, then all solutions have this form. On the other hand, if they are taken to be floating point operations, there may be other solutions due to round-off. – eyeballfrog Jun 10 at 17:15
• @eyeballfrog There isn't always a solution... let $c_1=c_2=\frac34$, $N=1$. – Don Thousand Jun 10 at 17:18