Doubt related to floor division

Revision en1, by __hermit__, 2020-12-14 14:00:58

Hi , I have one expression as follows:-

(b*y) — (r)*floor(b*y/r)

b and r are known. We can set any value of y of our choice >=0 .

Now what are the possible value that this expression can take?

By running for some values of r and b, I observed two things:-

if (b%r==0) then the answer is zero (which seems obvious to me) if(b%r!=0) then answer is the following :- g*K where K>=0 and K<= (r/g)-1.

Can someone provide the proof for second case? Also will the answer for following expression be similer? r*ceil(b*y/r)-b*y

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English __hermit__ 2020-12-14 14:00:58 597 Initial revision (published)