Quotient

J. Landman Gay jacque at hyperactivesw.com
Mon Jun 24 15:51:23 EDT 2019


I generally use "round" when working with pixels. But you don't have to, 
the LC engine seems to manage decimal pixels for you.

Clever, that engine.

On 6/24/19 2:34 PM, Richmond via use-livecode wrote:
> Thanks: I have.
> 
> BUT, imagine, if you will, a situation where I want to animate a blob as 
> in:
> 
> put 1 into LYNE
>    repeat until line LYNE of fld "PointsList" is empty
>      move grc "blob" to line LYNE of fld "PointsList"
>      wait 2 ticks
>      add 1 to LYNE
>   end repeat
> 
> Let's suppose those points should make the blob go round an invisible 
> circle
> (this is fairly old-hat as Benjamin Beaumont demonstrated this sort of 
> thing
> at the Edinburgh conference about 10 years ago) but, while I might generate
> the points of a circle using the ancient SINE-COSINE algorhthim (b*gger,
> how do you spell that word?), I want the points in the listField to end 
> up as
> whole numbers with no decimal component.
> 
> I'm not sure 'div' is going to be much help there.
> 
> I suppose I could be totally whacko and set up the decimal point as the 
> item delimiter
> and start splitting off bits . . . .
> 
> Richmond.
> 
> On 24.06.19 22:26, Mark Waddingham via use-livecode wrote:
>> Try ‘div’ :)
>>
>> Mark.
>>
>> Sent from my iPhone
>>
>>> On 24 Jun 2019, at 20:22, Richmond via use-livecode 
>>> <use-livecode at lists.runrev.com> wrote:
>>>
>>> Err . . .
>>>
>>> So; I have several numbers that have to be divided by other numbers:
>>>
>>> 28 / 3
>>>
>>> 301 / 10
>>>
>>> 44 / 6
>>>
>>> now these will all yield "awkward numbers" consisting of a quotient 
>>> and a remainder:
>>>
>>> 9.33
>>>
>>> 30.1
>>>
>>> 7.33
>>>
>>> Now I know one could be "ever so slightly potty" in LiveCode to get 
>>> the quotient by doing something
>>> like this:
>>>
>>> put 28/3 into XX
>>> put (28 mod 3) into YY
>>> put (XX - YY) into ZZ
>>>
>>> but that seems a long way round . . . but I cannot work out what the 
>>> equivalent term to 'mod'
>>> is to get the quotient in LiveCode.
>>>
>>> Richmond.


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com





More information about the Use-livecode mailing list