MOD function does not work! So be warned!
David Vaughan
drvaughan55 at mac.com
Fri Mar 29 03:17:01 EST 2002
On Friday, March 29, 2002, at 05:00 , Dar Scott wrote:
>
> The doc says nothing about this.
>
> I'm disappointed that we are reduced to talking about int and real,
> programmer jargon.
>
>>> The implication is that applications that need a decimal point need
>>> to have lots of special code.
>>
>> Not really. Treat it as one of string, integer or floating point (s,
>> m, e) and BCD or "binary point" can take care of themselves.
>
> I don't understand. I don't know of types in Revolution (except string
> vs array). Suppose I want to keep up with money. If I understand the
> implications of Ian's experiment, my books might not balance.
Rev is not a strongly typed language but I never expected that _all_
issues of data types would disappear. A solution (use round when it must
be integer, raise to the power 1 when it must be floating point and
concatenate with empty for a string) is straightforward enough and
rarely needed.
Incidentally, MS Excel fails the following test
mod(12.3,1.23) = 0
where rev gets it right so MC is not alone in having issues with mod
(Excel produces a residual of about 1e-15; not zero). Further, some
languages will, I believe, say that "-340 mod 60" is 20 or -20
(arguable) where the MC engine fairly rationally says -40 so that is
another one to consider.
I have had to compel the data type once or twice in HC and the same
stack(s) in RR but a general awareness of the possibility is usually
sufficient not to get caught by it. A bit like deliberately over-using
parentheses to make sure the compiler understands you; just being safe.
Perhaps some notes could be added to the documentation to raise this
awareness for all.
regards
David
>
> Dar Scott
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list