Quotient

Mark Waddingham mark at livecode.com
Tue Jun 25 04:09:39 EDT 2019


On 2019-06-24 21:26, Richmond via use-livecode wrote:
> But it is not much cop when it comes to finding
> the quotient of some long and complicated bit of Mathematics.

Perhaps not, but it is what you asked for...

   28 div 3 = 9
   28 mod 1 = 1

   28 / 3 = 9 + 1/3

   301 div 10 = 30
   301 mod 10 = 1

   301/10 = 30 + 1/10

   44 div 6 = 7
   44 mod 6 = 2

   44/6 = 7 + 2/6 = 7 + 1/3

More generally given X and Y you can rewrite X/Y as a 'quotient and a 
remainder' by defining:

   Q := X div Y
   R := X mod Y

Then you have that:

   X/Y = Q + R/Y

Just as when a human does such a computation R/Y can be often be reduced 
(if R and Y have any common factors) - i.e. by eliminating their 
greatest common divisor.

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the Use-livecode mailing list